Skip to content

Commit 1445637

Browse files
Yunshui Jianggregkh
authored andcommitted
net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and DEV_STATS_ADD()
[ Upstream commit b8ec0dc ] 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 <jiangyunshui@kylinos.cn> Message-ID: <20240531080739.2608969-1-jiangyunshui@kylinos.cn> Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7d56264 commit 1445637

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_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

@@ -86,8 +86,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
8686
goto err_tx;
8787
}
8888

89-
dev->stats.tx_packets++;
90-
dev->stats.tx_bytes += len;
89+
DEV_STATS_INC(dev, tx_packets);
90+
DEV_STATS_ADD(dev, tx_bytes, len);
9191
} else {
9292
local->tx_skb = skb;
9393
queue_work(local->workqueue, &local->tx_work);

0 commit comments

Comments
 (0)