Commit 60d8a79
can: bcm: fix stale rx/tx ops after device removal
commit 3b762c0 upstream.
RX: an RX_SETUP update(!) for an existing op skipped can_rx_register()
unconditionally, even when a concurrent NETDEV_UNREGISTER had already
torn down its registration (op->rx_reg_dev == NULL). This silently
did not re-enable frame delivery for that updated filter. bcm_rx_setup()
now re-registers in that case, while leaving rx_ops with ifindex = 0
(all CAN devices) which never carry a tracked rx_reg_dev registered as-is.
TX: bcm_notify() only handled bo->rx_ops on NETDEV_UNREGISTER, leaving
tx_ops with an active cyclic transmission re-arming its hrtimer
indefinitely to execute bcm_tx_timeout_handler(). Cancelling the hrtimer
prevents the runaway timer and any injection into a later reused ifindex,
since nothing else calls bcm_can_tx() for the op until an explicit
TX_SETUP update re-arms it.
Unlike bcm_rx_unreg(), which clears the tracked rx_reg_dev for rx_ops,
the ifindex is intentionally left unchanged for tx_ops. bcm_tx_setup()
always rejects ifindex 0, so clearing it would strand the op: neither a
later TX_SETUP (bcm_find_op()) nor TX_DELETE (bcm_delete_tx_op()) could
ever find it again, since both require an exact ifindex match.
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/linux-can/20260708094536.DDF821F00A3A@smtp.kernel.org/
Closes: https://lore.kernel.org/linux-can/20260708154039.347ED1F000E9@smtp.kernel.org/
Fixes: ffd980f ("[CAN]: Add broadcast manager (bcm) protocol")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://patch.msgid.link/20260714-bcm_fixes-v15-9-562f7e3e42da@hartkopp.net
Cc: stable@kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 84aa480 commit 60d8a79
1 file changed
Lines changed: 44 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1239 | 1239 | | |
1240 | 1240 | | |
1241 | 1241 | | |
| 1242 | + | |
1242 | 1243 | | |
1243 | 1244 | | |
1244 | 1245 | | |
| |||
1323 | 1324 | | |
1324 | 1325 | | |
1325 | 1326 | | |
1326 | | - | |
1327 | | - | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
1328 | 1336 | | |
1329 | 1337 | | |
1330 | 1338 | | |
| |||
1394 | 1402 | | |
1395 | 1403 | | |
1396 | 1404 | | |
| 1405 | + | |
1397 | 1406 | | |
1398 | 1407 | | |
1399 | 1408 | | |
| |||
1407 | 1416 | | |
1408 | 1417 | | |
1409 | 1418 | | |
1410 | | - | |
| 1419 | + | |
1411 | 1420 | | |
1412 | 1421 | | |
1413 | 1422 | | |
| |||
1437 | 1446 | | |
1438 | 1447 | | |
1439 | 1448 | | |
1440 | | - | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
1441 | 1453 | | |
1442 | 1454 | | |
1443 | 1455 | | |
| |||
1467 | 1479 | | |
1468 | 1480 | | |
1469 | 1481 | | |
1470 | | - | |
| 1482 | + | |
1471 | 1483 | | |
1472 | 1484 | | |
1473 | 1485 | | |
| 1486 | + | |
| 1487 | + | |
1474 | 1488 | | |
1475 | | - | |
1476 | | - | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1477 | 1502 | | |
1478 | 1503 | | |
1479 | 1504 | | |
1480 | | - | |
1481 | | - | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
1482 | 1508 | | |
1483 | 1509 | | |
1484 | 1510 | | |
| |||
1694 | 1720 | | |
1695 | 1721 | | |
1696 | 1722 | | |
1697 | | - | |
| 1723 | + | |
1698 | 1724 | | |
1699 | 1725 | | |
1700 | 1726 | | |
1701 | 1727 | | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1702 | 1736 | | |
1703 | 1737 | | |
1704 | 1738 | | |
| |||
0 commit comments