Repository navigation
Commit 55d9004
vsock: fix the race conditions in multi-transport support
commit c518ada upstream.
There are multiple similar bugs implicitly introduced by the
commit c0cfa2d ("vsock: add multi-transports support") and
commit 6a2c096 ("vsock: prevent transport modules unloading").
The bug pattern:
[1] vsock_sock.transport pointer is copied to a local variable,
[2] lock_sock() is called,
[3] the local variable is used.
VSOCK multi-transport support introduced the race condition:
vsock_sock.transport value may change between [1] and [2].
Let's copy vsock_sock.transport pointer to local variables after
the lock_sock() call.
Fixes: c0cfa2d ("vsock: add multi-transports support")
Signed-off-by: Alexander Popov <alex.popov@linux.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Link: https://lore.kernel.org/r/20210201084719.2257066-1-alex.popov@linux.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent a9cd144 commit 55d9004
1 file changed
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
997 | 997 | | |
998 | 998 | | |
999 | 999 | | |
1000 | | - | |
| 1000 | + | |
| 1001 | + | |
1001 | 1002 | | |
1002 | 1003 | | |
| 1004 | + | |
| 1005 | + | |
1003 | 1006 | | |
1004 | 1007 | | |
1005 | 1008 | | |
| |||
1082 | 1085 | | |
1083 | 1086 | | |
1084 | 1087 | | |
1085 | | - | |
1086 | 1088 | | |
1087 | 1089 | | |
1088 | 1090 | | |
| 1091 | + | |
| 1092 | + | |
1089 | 1093 | | |
1090 | 1094 | | |
1091 | 1095 | | |
| |||
1544 | 1548 | | |
1545 | 1549 | | |
1546 | 1550 | | |
1547 | | - | |
1548 | 1551 | | |
1549 | 1552 | | |
1550 | 1553 | | |
| 1554 | + | |
| 1555 | + | |
1551 | 1556 | | |
1552 | 1557 | | |
1553 | 1558 | | |
| |||
1680 | 1685 | | |
1681 | 1686 | | |
1682 | 1687 | | |
1683 | | - | |
1684 | 1688 | | |
1685 | 1689 | | |
1686 | 1690 | | |
| |||
1689 | 1693 | | |
1690 | 1694 | | |
1691 | 1695 | | |
| 1696 | + | |
| 1697 | + | |
1692 | 1698 | | |
1693 | 1699 | | |
1694 | 1700 | | |
| |||
1823 | 1829 | | |
1824 | 1830 | | |
1825 | 1831 | | |
1826 | | - | |
1827 | 1832 | | |
1828 | 1833 | | |
1829 | 1834 | | |
1830 | 1835 | | |
| 1836 | + | |
| 1837 | + | |
1831 | 1838 | | |
1832 | 1839 | | |
1833 | 1840 | | |
| |||
0 commit comments