From 2373699560a754079579b7722b50d1d38de1960e Mon Sep 17 00:00:00 2001 From: Miquel Raynal Date: Tue, 28 Nov 2023 12:16:55 +0100 Subject: 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 Acked-by: Stefan Schmidt Acked-by: Alexander Aring Link: https://lore.kernel.org/linux-wpan/20231128111655.507479-6-miquel.raynal@bootlin.com --- net/ieee802154/pan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'net/ieee802154') 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); -- cgit v1.2.3