aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/recursion.c
diff options
context:
space:
mode:
authorDuoming Zhou <[email protected]>2022-04-05 13:22:06 +0000
committerJakub Kicinski <[email protected]>2022-04-07 06:00:16 +0000
commitec4eb8a86ade4d22633e1da2a7d85a846b7d1798 (patch)
tree83177045d62c3294479a81517c3a3ca68636b7a2 /tools/testing/selftests/bpf/prog_tests/recursion.c
parentMerge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf (diff)
downloadkernel-ec4eb8a86ade4d22633e1da2a7d85a846b7d1798.tar.gz
kernel-ec4eb8a86ade4d22633e1da2a7d85a846b7d1798.zip
drivers: net: slip: fix NPD bug in sl_tx_timeout()
When a slip driver is detaching, the slip_close() will act to cleanup necessary resources and sl->tty is set to NULL in slip_close(). Meanwhile, the packet we transmit is blocked, sl_tx_timeout() will be called. Although slip_close() and sl_tx_timeout() use sl->lock to synchronize, we don`t judge whether sl->tty equals to NULL in sl_tx_timeout() and the null pointer dereference bug will happen. (Thread 1) | (Thread 2) | slip_close() | spin_lock_bh(&sl->lock) | ... ... | sl->tty = NULL //(1) sl_tx_timeout() | spin_unlock_bh(&sl->lock) spin_lock(&sl->lock); | ... | ... tty_chars_in_buffer(sl->tty)| if (tty->ops->..) //(2) | ... | synchronize_rcu() We set NULL to sl->tty in position (1) and dereference sl->tty in position (2). This patch adds check in sl_tx_timeout(). If sl->tty equals to NULL, sl_tx_timeout() will goto out. Signed-off-by: Duoming Zhou <[email protected]> Reviewed-by: Jiri Slaby <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/recursion.c')
0 files changed, 0 insertions, 0 deletions