Commit 3b762c0
can: bcm: fix stale rx/tx ops after device removal
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>1 parent d599482 commit 3b762c0
1 file changed
Lines changed: 44 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1287 | 1287 | | |
1288 | 1288 | | |
1289 | 1289 | | |
| 1290 | + | |
1290 | 1291 | | |
1291 | 1292 | | |
1292 | 1293 | | |
| |||
1371 | 1372 | | |
1372 | 1373 | | |
1373 | 1374 | | |
1374 | | - | |
1375 | | - | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
1376 | 1384 | | |
1377 | 1385 | | |
1378 | 1386 | | |
| |||
1439 | 1447 | | |
1440 | 1448 | | |
1441 | 1449 | | |
| 1450 | + | |
1442 | 1451 | | |
1443 | 1452 | | |
1444 | 1453 | | |
| |||
1452 | 1461 | | |
1453 | 1462 | | |
1454 | 1463 | | |
1455 | | - | |
| 1464 | + | |
1456 | 1465 | | |
1457 | 1466 | | |
1458 | 1467 | | |
| |||
1482 | 1491 | | |
1483 | 1492 | | |
1484 | 1493 | | |
1485 | | - | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
1486 | 1498 | | |
1487 | 1499 | | |
1488 | 1500 | | |
| |||
1514 | 1526 | | |
1515 | 1527 | | |
1516 | 1528 | | |
1517 | | - | |
| 1529 | + | |
1518 | 1530 | | |
1519 | 1531 | | |
1520 | 1532 | | |
| 1533 | + | |
| 1534 | + | |
1521 | 1535 | | |
1522 | | - | |
1523 | | - | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
1524 | 1549 | | |
1525 | 1550 | | |
1526 | 1551 | | |
1527 | | - | |
1528 | | - | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
1529 | 1555 | | |
1530 | 1556 | | |
1531 | 1557 | | |
| |||
1745 | 1771 | | |
1746 | 1772 | | |
1747 | 1773 | | |
1748 | | - | |
| 1774 | + | |
1749 | 1775 | | |
1750 | 1776 | | |
1751 | 1777 | | |
1752 | 1778 | | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
1753 | 1787 | | |
1754 | 1788 | | |
1755 | 1789 | | |
| |||
0 commit comments