Message ID | 20240528022613.1974961-1-jiangyunshui@kylinos.cn |
---|---|
State | Superseded |
Headers | show |
Series | [-v3] Bluetooth: 6lowpan: use DEV_STAT_INC() to avoid races | expand |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=856341 ---Test result--- Test Summary: CheckPatch PASS 0.46 seconds GitLint PASS 0.19 seconds SubjectPrefix PASS 0.06 seconds BuildKernel PASS 29.45 seconds CheckAllWarning PASS 32.52 seconds CheckSparse PASS 37.78 seconds CheckSmatch FAIL 34.80 seconds BuildKernel32 PASS 28.65 seconds TestRunnerSetup PASS 521.62 seconds TestRunner_l2cap-tester PASS 18.17 seconds TestRunner_iso-tester PASS 32.60 seconds TestRunner_bnep-tester PASS 4.81 seconds TestRunner_mgmt-tester PASS 112.67 seconds TestRunner_rfcomm-tester PASS 7.35 seconds TestRunner_sco-tester PASS 14.94 seconds TestRunner_ioctl-tester PASS 7.78 seconds TestRunner_mesh-tester PASS 6.81 seconds TestRunner_smp-tester PASS 6.93 seconds TestRunner_userchan-tester PASS 4.99 seconds IncrementalBuild PASS 27.66 seconds Details ############################## Test: CheckSmatch - FAIL Desc: Run smatch tool with source Output: Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o' make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2 make[2]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o' make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2 --- Regards, Linux Bluetooth
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 50cfec8ccac4..8eb2cf58c00e 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -295,8 +295,8 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev, goto drop; } - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; + DEV_STATS_ADD(dev, rx_bytes, skb->len); + DEV_STATS_INC(dev, rx_packets); consume_skb(local_skb); consume_skb(skb); @@ -323,8 +323,8 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev, goto drop; } - dev->stats.rx_bytes += skb->len; - dev->stats.rx_packets++; + DEV_STATS_ADD(dev, rx_bytes, skb->len); + DEV_STATS_INC(dev, rx_packets); consume_skb(local_skb); consume_skb(skb); @@ -336,7 +336,7 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev, return NET_RX_SUCCESS; drop: - dev->stats.rx_dropped++; + DEV_STATS_INC(dev, rx_dropped); return NET_RX_DROP; } @@ -445,13 +445,13 @@ static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb, err = l2cap_chan_send(chan, &msg, skb->len); if (err > 0) { - netdev->stats.tx_bytes += err; - netdev->stats.tx_packets++; + DEV_STATS_ADD(netdev, tx_bytes, err); + DEV_STATS_INC(netdev, tx_packets); return 0; } if (err < 0) - netdev->stats.tx_errors++; + DEV_STATS_INC(netdev, tx_errors); return err; }
syzbot/KCSAN reported that races happen when multiple cpus updating dev->stats.tx_error concurrently. Adopt SMP safe DEV_STATS_INC() to update dev->stats fields. Signed-off-by: Yunshui Jiang <jiangyunshui@kylinos.cn> --- net/bluetooth/6lowpan.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)