Skip to content

Commit d73ff9b

Browse files
hartkoppmarckleinebudde
authored andcommitted
can: af_can: can_rx_unregister(): remove WARN() statement from list operation sanity check
To detect potential bugs in CAN protocol implementations (double removal of receiver entries) a WARN() statement has been used if no matching list item was found for removal. The fault injection issued by syzkaller was able to create a situation where the closing of a socket runs simultaneously to the notifier call chain for removing the CAN network device in use. This case is very unlikely in real life but it doesn't break anything. Therefore we just replace the WARN() statement with pr_warn() to preserve the notification for the CAN protocol development. Reported-by: syzbot+381d06e0c8eaacb8706f@syzkaller.appspotmail.com Reported-by: syzbot+d0ddd88c9a7432f041e6@syzkaller.appspotmail.com Reported-by: syzbot+76d62d3b8162883c7d11@syzkaller.appspotmail.com Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Link: https://lore.kernel.org/r/20201126192140.14350-1-socketcan@hartkopp.net Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 5c7d55b commit d73ff9b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

net/can/af_can.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,13 @@ void can_rx_unregister(struct net *net, struct net_device *dev, canid_t can_id,
541541

542542
/* Check for bugs in CAN protocol implementations using af_can.c:
543543
* 'rcv' will be NULL if no matching list item was found for removal.
544+
* As this case may potentially happen when closing a socket while
545+
* the notifier for removing the CAN netdev is running we just print
546+
* a warning here.
544547
*/
545548
if (!rcv) {
546-
WARN(1, "BUG: receive list entry not found for dev %s, id %03X, mask %03X\n",
547-
DNAME(dev), can_id, mask);
549+
pr_warn("can: receive list entry not found for dev %s, id %03X, mask %03X\n",
550+
DNAME(dev), can_id, mask);
548551
goto out;
549552
}
550553

0 commit comments

Comments
 (0)