nbd: Fix NULL pointer in flush_workqueue
Sun Ke authored
[ Upstream commit 79ebe911 ]

Open /dev/nbdX first, the config_refs will be 1 and
the pointers in nbd_device are still null. Disconnect
/dev/nbdX, then reference a null recv_workq. The
protection by config_refs in nbd_genl_disconnect is useless.

[  656.366194] BUG: kernel NULL pointer dereference, address: 0000000000000020
[  656.368943] #PF: supervisor write access in kernel mode
[  656.369844] #PF: error_code(0x0002) - not-present page
[  656.370717] PGD 10cc87067 P4D 10cc87067 PUD 1074b4067 PMD 0
[  656.371693] Oops: 0002 [#1] SMP
[  656.372242] CPU: 5 PID: 7977 Comm: nbd-client Not tainted 5.11.0-rc5-00040-g76c057c8 #1
[  656.373661] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-ppc64le-16.ppc.fedoraproject.org-3.fc31 04/01/2014
[  656.375904] RIP: 0010:mutex_lock+0x29/0x60
[  656.376627] Code: 00 0f 1f 44 00 00 55 48 89 fd 48 83 05 6f d7 fe 08 01 e8 7a c3 ff ff 48 83 05 6a d7 fe 08 01...
1c4962df
Name Last commit Last update
Documentation dt-bindings: net: ethernet-controller: fix typo in NVMEM
LICENSES LICENSES: Rename other to deprecated
arch powerpc/64s: Fix crashes when toggling entry flush barrier
block kyber: fix out of bounds access when preempted
certs certs: Fix blacklist flag type confusion
crypto crypto: rng - fix crypto_rng_reset() refcounting when !CRYPTO_STATS
drivers nbd: Fix NULL pointer in flush_workqueue
fs mm/hugetlb: fix F_SEAL_FUTURE_WRITE
include kyber: fix out of bounds access when preempted
init init/Kconfig: make COMPILE_TEST depend on HAS_IOMEM
ipc ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
kernel kernel: kexec_file: fix error return code of kexec_calculate_store_digests()
lib net: fix nla_strcmp to handle more then one trailing null character
mm mm/hugetlb: fix F_SEAL_FUTURE_WRITE
net netfilter: nftables: avoid overflows in nft_hash_buckets()
samples samples/bpf: Fix broken tracex1 due to kprobe argument change
scripts kconfig: nconf: stop endless search loops
security security: commoncap: fix -Wstringop-overread warning
sound ASoC: rt286: Make RT286_SET_GPIO_* readable and writable
tools selftests: Set CC to clang in lib.mk if LLVM is set
usr initramfs: restore default compression behavior
virt KVM: Stop looking for coalesced MMIO zones if the bus is destroyed
.clang-format clang-format: Update with the latest for_each macro list
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
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.