Skip to content

Commit ed9a8ad

Browse files
miquelraynalStefan-Schmidt
authored andcommitted
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: ed3557c ("ieee802154: Add support for user scanning requests") Fixes: 9bc1145 ("ieee802154: Add support for user beaconing requests") Reported-by: Jakub Kicinski <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stefan Schmidt <[email protected]>
1 parent 61d7ddd commit ed9a8ad

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

net/ieee802154/nl802154.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,20 +1453,14 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
14531453
else
14541454
request->duration = IEEE802154_MAX_SCAN_DURATION;
14551455

1456-
if (wpan_dev->netdev)
1457-
dev_hold(wpan_dev->netdev);
1458-
14591456
err = rdev_trigger_scan(rdev, request);
14601457
if (err) {
14611458
pr_err("Failure starting scanning (%d)\n", err);
1462-
goto free_device;
1459+
goto free_request;
14631460
}
14641461

14651462
return 0;
14661463

1467-
free_device:
1468-
if (wpan_dev->netdev)
1469-
dev_put(wpan_dev->netdev);
14701464
free_request:
14711465
kfree(request);
14721466

@@ -1555,9 +1549,6 @@ int nl802154_scan_done(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
15551549
if (err == -ESRCH)
15561550
err = 0;
15571551

1558-
if (wpan_dev->netdev)
1559-
dev_put(wpan_dev->netdev);
1560-
15611552
return err;
15621553
}
15631554
EXPORT_SYMBOL_GPL(nl802154_scan_done);
@@ -1605,30 +1596,23 @@ nl802154_send_beacons(struct sk_buff *skb, struct genl_info *info)
16051596
else
16061597
request->interval = IEEE802154_MAX_SCAN_DURATION;
16071598

1608-
if (wpan_dev->netdev)
1609-
dev_hold(wpan_dev->netdev);
1610-
16111599
err = rdev_send_beacons(rdev, request);
16121600
if (err) {
16131601
pr_err("Failure starting sending beacons (%d)\n", err);
1614-
goto free_device;
1602+
goto free_request;
16151603
}
16161604

16171605
return 0;
16181606

1619-
free_device:
1620-
if (wpan_dev->netdev)
1621-
dev_put(wpan_dev->netdev);
1622-
1607+
free_request:
16231608
kfree(request);
16241609

16251610
return err;
16261611
}
16271612

16281613
void nl802154_beaconing_done(struct wpan_dev *wpan_dev)
16291614
{
1630-
if (wpan_dev->netdev)
1631-
dev_put(wpan_dev->netdev);
1615+
/* NOP */
16321616
}
16331617
EXPORT_SYMBOL_GPL(nl802154_beaconing_done);
16341618

0 commit comments

Comments
 (0)