summaryrefslogtreecommitdiff
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorLin Ma <linma@zju.edu.cn>2021-12-17 10:29:41 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-29 11:50:30 +0100
commit3d3d6f7a2d4e9b5666c9c9e6a83dc2bb0c92a05a (patch)
treea47501b346a32c2943508f17b443780fe991c5a6 /include/linux/kernel.h
parente29b3284f363b26806ce68e8c09454e186bc633a (diff)
ax25: NPD bug when detaching AX25 device
commit 1ade48d0c27d5da1ccf4b583d8c5fc8b534a3ac8 upstream. The existing cleanup routine implementation is not well synchronized with the syscall routine. When a device is detaching, below race could occur. static int ax25_sendmsg(...) { ... lock_sock() ax25 = sk_to_ax25(sk); if (ax25->ax25_dev == NULL) // CHECK ... ax25_queue_xmit(skb, ax25->ax25_dev->dev); // USE ... } static void ax25_kill_by_device(...) { ... if (s->ax25_dev == ax25_dev) { s->ax25_dev = NULL; ... } Other syscall functions like ax25_getsockopt, ax25_getname, ax25_info_show also suffer from similar races. To fix them, this patch introduce lock_sock() into ax25_kill_by_device in order to guarantee that the nullify action in cleanup routine cannot proceed when another socket request is pending. Signed-off-by: Hanjie Wu <nagi@zju.edu.cn> Signed-off-by: Lin Ma <linma@zju.edu.cn> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/kernel.h')
0 files changed, 0 insertions, 0 deletions