Find a file
Duoming Zhou ec4eb8a86a 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 <duoming@zju.edu.cn>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20220405132206.55291-1-duoming@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-04-06 23:00:16 -07:00
arch Networking fixes for 5.18-rc1 and rethook patches. 2022-03-31 11:23:31 -07:00
block ptrace: Cleanups for v5.18 2022-03-28 17:29:53 -07:00
certs KEYS: Introduce link restriction for machine keys 2022-03-08 13:55:52 +02:00
crypto for-5.18/64bit-pi-2022-03-25 2022-03-26 12:01:35 -07:00
Documentation dt-bindings: net: add pcs-handle attribute 2022-04-06 13:54:51 +01:00
drivers drivers: net: slip: fix NPD bug in sl_tx_timeout() 2022-04-06 23:00:16 -07:00
fs fs: fix fd table size alignment properly 2022-03-29 23:29:18 -07:00
include Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2022-04-06 21:58:50 -07:00
init Merge branch 'akpm' (patches from Andrew) 2022-03-24 14:14:07 -07:00
ipc fs: allocate inode by using alloc_inode_sb() 2022-03-22 15:57:03 -07:00
kernel Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2022-04-06 21:58:50 -07:00
lib lib/test: use after free in register_test_dev_kmod() 2022-03-29 15:13:36 -07:00
LICENSES LICENSES/LGPL-2.1: Add LGPL-2.1-or-later as valid identifiers 2021-12-16 14:33:10 +01:00
mm mm: page_alloc: validate buddy before check its migratetype. 2022-03-30 15:45:43 -07:00
net Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2022-04-06 21:58:50 -07:00
samples dma-mapping updates for Linux 5.18 2022-03-29 08:50:14 -07:00
scripts Driver core changes for 5.18-rc1 2022-03-28 12:41:28 -07:00
security ptrace: Cleanups for v5.18 2022-03-28 17:29:53 -07:00
sound xen: branch for v5.18-rc1 2022-03-28 14:32:39 -07:00
tools Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2022-04-06 21:58:50 -07:00
usr reiserfs_xattr.h: add linux/reiserfs_xattr.h to UAPI compile-test coverage 2022-02-17 09:09:38 +01:00
virt KVM: compat: riscv: Prevent KVM_COMPAT from being selected 2022-03-11 19:02:15 +05:30
.clang-format genirq/msi: Make interrupt allocation less convoluted 2021-12-16 22:22:20 +01:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes .gitattributes: use 'dts' diff driver for dts files 2019-12-04 19:44:11 -08:00
.gitignore .gitignore: ignore only top-level modules.builtin 2021-05-02 00:43:35 +09:00
.mailmap Char/Misc and other driver updates for 5.18-rc1 2022-03-28 12:27:35 -07:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: replace a Microchip AT91 maintainer 2022-02-09 11:30:01 +01:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS Networking fixes for 5.18-rc1 and rethook patches. 2022-03-31 11:23:31 -07:00
Makefile array-bounds updates for v5.18-rc1 2022-03-26 12:30:44 -07:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.