Commit 52565a9
net: kcm: Fix race condition in kcm_unattach()
syzbot found a race condition when kcm_unattach(psock)
and kcm_release(kcm) are executed at the same time.
kcm_unattach() is missing a check of the flag
kcm->tx_stopped before calling queue_work().
If the kcm has a reserved psock, kcm_unattach() might get executed
between cancel_work_sync() and unreserve_psock() in kcm_release(),
requeuing kcm->tx_work right before kcm gets freed in kcm_done().
Remove kcm->tx_stopped and replace it by the less
error-prone disable_work_sync().
Fixes: ab7ac4e ("kcm: Kernel Connection Multiplexor module")
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=e62c9db591c30e174662
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
Reported-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=be6b1fdfeae512726b4e
Signed-off-by: Sven Stegemann <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent 1c75609 commit 52565a9
2 files changed
+2
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
433 | | - | |
| 433 | + | |
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| |||
1693 | 1693 | | |
1694 | 1694 | | |
1695 | 1695 | | |
1696 | | - | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | 1696 | | |
1703 | 1697 | | |
1704 | 1698 | | |
| |||
1714 | 1708 | | |
1715 | 1709 | | |
1716 | 1710 | | |
1717 | | - | |
| 1711 | + | |
1718 | 1712 | | |
1719 | 1713 | | |
1720 | 1714 | | |
| |||
0 commit comments