[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230214135035.1202471-7-miquel.raynal@bootlin.com>
Date: Tue, 14 Feb 2023 14:50:35 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Alexander Aring <alex.aring@...il.com>,
Stefan Schmidt <stefan@...enfreihafen.org>,
linux-wpan@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>, netdev@...r.kernel.org,
David Girault <david.girault@...vo.com>,
Romuald Despres <romuald.despres@...vo.com>,
Frederic Blain <frederic.blain@...vo.com>,
Nicolas Schodet <nico@...fr.eu.org>,
Guilhem Imberton <guilhem.imberton@...vo.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Miquel Raynal <miquel.raynal@...tlin.com>
Subject: [PATCH wpan v2 6/6] ieee802154: Drop device trackers
In order to prevent a device from disappearing when a background job was
started, dev_hold() and dev_put() calls were made. During the
stabilization phase of the scan/beacon features, it was later decided
that removing the device while a background job was ongoing was a valid use
case, and we should instead stop the background job and then remove the
device, rather than prevent the device from being removed. This is what
is currently done, which means manually reference counting the device
during background jobs is no longer needed.
Fixes: ed3557c947e1 ("ieee802154: Add support for user scanning requests")
Fixes: 9bc114504b07 ("ieee802154: Add support for user beaconing requests")
Reported-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
---
net/ieee802154/nl802154.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 8ee7d2ef55ee..88380606af2c 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -1453,20 +1453,14 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
else
request->duration = IEEE802154_MAX_SCAN_DURATION;
- if (wpan_dev->netdev)
- dev_hold(wpan_dev->netdev);
-
err = rdev_trigger_scan(rdev, request);
if (err) {
pr_err("Failure starting scanning (%d)\n", err);
- goto free_device;
+ goto free_request;
}
return 0;
-free_device:
- if (wpan_dev->netdev)
- dev_put(wpan_dev->netdev);
free_request:
kfree(request);
@@ -1555,9 +1549,6 @@ int nl802154_scan_done(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
if (err == -ESRCH)
err = 0;
- if (wpan_dev->netdev)
- dev_put(wpan_dev->netdev);
-
return err;
}
EXPORT_SYMBOL_GPL(nl802154_scan_done);
@@ -1605,21 +1596,15 @@ nl802154_send_beacons(struct sk_buff *skb, struct genl_info *info)
else
request->interval = IEEE802154_MAX_SCAN_DURATION;
- if (wpan_dev->netdev)
- dev_hold(wpan_dev->netdev);
-
err = rdev_send_beacons(rdev, request);
if (err) {
pr_err("Failure starting sending beacons (%d)\n", err);
- goto free_device;
+ goto free_request;
}
return 0;
-free_device:
- if (wpan_dev->netdev)
- dev_put(wpan_dev->netdev);
-
+free_request:
kfree(request);
return err;
@@ -1627,8 +1612,7 @@ nl802154_send_beacons(struct sk_buff *skb, struct genl_info *info)
void nl802154_beaconing_done(struct wpan_dev *wpan_dev)
{
- if (wpan_dev->netdev)
- dev_put(wpan_dev->netdev);
+ /* NOP */
}
EXPORT_SYMBOL_GPL(nl802154_beaconing_done);
--
2.34.1
Powered by blists - more mailing lists