summaryrefslogtreecommitdiff
path: root/net/ieee802154/pan.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2023-11-28 14:16:55 +0300
committerMiquel Raynal <miquel.raynal@bootlin.com>2023-12-15 13:14:57 +0300
commit2373699560a754079579b7722b50d1d38de1960e (patch)
tree96f7a25ef1181e69e15f135587aa71440f0945f2 /net/ieee802154/pan.c
parentb720383ab1cfd584c8c0d9fc7b8cc541ed76dba5 (diff)
downloadlinux-2373699560a754079579b7722b50d1d38de1960e.tar.xz
mac802154: Avoid new associations while disassociating
While disassociating from a PAN ourselves, let's set the maximum number of associations temporarily to zero to be sure no new device tries to associate with us. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org> Acked-by: Alexander Aring <aahringo@redhat.com> Link: https://lore.kernel.org/linux-wpan/20231128111655.507479-6-miquel.raynal@bootlin.com
Diffstat (limited to 'net/ieee802154/pan.c')
-rw-r--r--net/ieee802154/pan.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ieee802154/pan.c b/net/ieee802154/pan.c
index fb5b0af2ef68..249df7364b3e 100644
--- a/net/ieee802154/pan.c
+++ b/net/ieee802154/pan.c
@@ -94,10 +94,16 @@ __le16 cfg802154_get_free_short_addr(struct wpan_dev *wpan_dev)
}
EXPORT_SYMBOL_GPL(cfg802154_get_free_short_addr);
-void cfg802154_set_max_associations(struct wpan_dev *wpan_dev, unsigned int max)
+unsigned int cfg802154_set_max_associations(struct wpan_dev *wpan_dev,
+ unsigned int max)
{
+ unsigned int old_max;
+
lockdep_assert_held(&wpan_dev->association_lock);
+ old_max = wpan_dev->max_associations;
wpan_dev->max_associations = max;
+
+ return old_max;
}
EXPORT_SYMBOL_GPL(cfg802154_set_max_associations);