Skip to content

Commit b8ec0dc

Browse files
Yunshui JiangStefan-Schmidt
authored andcommitted
net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD()
mac802154 devices update their dev->stats fields locklessly. Therefore these counters should be updated atomically. Adopt SMP safe DEV_STATS_INC() and DEV_STATS_ADD() to achieve this. Signed-off-by: Yunshui Jiang <[email protected]> Message-ID: <[email protected]> Signed-off-by: Stefan Schmidt <[email protected]>
1 parent 07aa339 commit b8ec0dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/mac802154/tx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ void ieee802154_xmit_sync_worker(struct work_struct *work)
3434
if (res)
3535
goto err_tx;
3636

37-
dev->stats.tx_packets++;
38-
dev->stats.tx_bytes += skb->len;
37+
DEV_STATS_INC(dev, tx_packets);
38+
DEV_STATS_ADD(dev, tx_bytes, skb->len);
3939

4040
ieee802154_xmit_complete(&local->hw, skb, false);
4141

@@ -90,8 +90,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
9090
if (ret)
9191
goto err_wake_netif_queue;
9292

93-
dev->stats.tx_packets++;
94-
dev->stats.tx_bytes += len;
93+
DEV_STATS_INC(dev, tx_packets);
94+
DEV_STATS_ADD(dev, tx_bytes, len);
9595
} else {
9696
local->tx_skb = skb;
9797
queue_work(local->workqueue, &local->sync_tx_work);

0 commit comments

Comments
 (0)