Go to file
Markus Weippert 0daf3b0fe4 bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
commit bb6cc25386 upstream.

Commit 028ddcac47 ("bcache: Remove unnecessary NULL point check in
node allocations") replaced IS_ERR_OR_NULL by IS_ERR. This leads to a
NULL pointer dereference.

BUG: kernel NULL pointer dereference, address: 0000000000000080
Call Trace:
 ? __die_body.cold+0x1a/0x1f
 ? page_fault_oops+0xd2/0x2b0
 ? exc_page_fault+0x70/0x170
 ? asm_exc_page_fault+0x22/0x30
 ? btree_node_free+0xf/0x160 [bcache]
 ? up_write+0x32/0x60
 btree_gc_coalesce+0x2aa/0x890 [bcache]
 ? bch_extent_bad+0x70/0x170 [bcache]
 btree_gc_recurse+0x130/0x390 [bcache]
 ? btree_gc_mark_node+0x72/0x230 [bcache]
 bch_btree_gc+0x5da/0x600 [bcache]
 ? cpuusage_read+0x10/0x10
 ? bch_btree_gc+0x600/0x600 [bcache]
 bch_gc_thread+0x135/0x180 [bcache]

The relevant code starts with:

    new_nodes[0] = NULL;

    for (i = 0; i < nodes; i++) {
        if (__bch_keylist_realloc(&keylist, bkey_u64s(&r[i].b->key)))
            goto out_nocoalesce;
    // ...
out_nocoalesce:
    // ...
    for (i = 0; i < nodes; i++)
        if (!IS_ERR(new_nodes[i])) {  // IS_ERR_OR_NULL before
028ddcac47
            btree_node_free(new_nodes[i]);  // new_nodes[0] is NULL
            rw_unlock(true, new_nodes[i]);
        }

This patch replaces IS_ERR() by IS_ERR_OR_NULL() to fix this.

Fixes: 028ddcac47 ("bcache: Remove unnecessary NULL point check in node allocations")
Link: https://lore.kernel.org/all/3DF4A87A-2AC1-4893-AE5F-E921478419A9@suse.de/
Cc: stable@vger.kernel.org
Cc: Zheng Wang <zyytlz.wz@163.com>
Cc: Coly Li <colyli@suse.de>
Signed-off-by: Markus Weippert <markus@gekmihesg.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-08 08:52:19 +01:00
Documentation leds: class: Don't expose color sysfs entry 2023-12-08 08:52:15 +01:00
LICENSES
arch arm/xen: fix xen_vcpu_info allocation alignment 2023-12-03 07:33:05 +01:00
block block: update the stable_writes flag in bdev_add 2023-12-03 07:33:03 +01:00
certs
crypto crypto: pcrypt - Fix hungtask for PADATA_RESET 2023-11-28 17:19:42 +00:00
drivers bcache: revert replacing IS_ERR_OR_NULL with IS_ERR 2023-12-08 08:52:19 +01:00
fs ksmbd: fix possible deadlock in smb2_open 2023-12-08 08:52:15 +01:00
include iommu: Avoid more races around device probe 2023-12-08 08:52:19 +01:00
init proc: sysctl: prevent aliased sysctls from getting passed to init 2023-11-28 17:19:57 +00:00
io_uring io_uring: don't guard IORING_OFF_PBUF_RING with SETUP_NO_MMAP 2023-12-08 08:52:19 +01:00
ipc Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
kernel prctl: Disable prctl(PR_SET_MDWE) on parisc 2023-12-03 07:33:06 +01:00
lib lib/generic-radix-tree.c: Don't overflow in peek() 2023-11-28 17:19:35 +00:00
mm filemap: add a per-mapping stable writes flag 2023-12-03 07:33:03 +01:00
net tls: fix NULL deref on tls_sw_splice_eof() with empty record 2023-12-03 07:33:07 +01:00
rust rust: docs: fix logo replacement 2023-10-19 16:40:00 +02:00
samples samples/bpf: syscall_tp_user: Fix array out-of-bound access 2023-11-28 17:19:48 +00:00
scripts scripts/gdb/vmalloc: disable on no-MMU 2023-11-28 17:20:05 +00:00
security apparmor: Fix regression in mount mediation 2023-11-28 17:20:07 +00:00
sound ALSA: hda/realtek: Add supported ALC257 for ChromeOS 2023-12-08 08:52:16 +01:00
tools kselftest/arm64: Fix output formatting for za-fork 2023-12-03 07:33:06 +01:00
usr
virt ARM: 2023-09-07 13:52:20 -07:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap 20 hotfixes. 12 are cc:stable and the remainder address post-6.5 issues 2023-10-24 09:52:16 -10:00
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS Char/Misc driver fixes for 6.6-final 2023-10-28 07:51:27 -10:00
Makefile Linux 6.6.4 2023-12-03 07:33:10 +01:00
README

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.