CVE-2024-26868 Information
Description
In the Linux kernel the following vulnerability has been resolved:
nfs: fix panic when nfs4_ff_layout_prepare_ds() fails
We’ve been seeing the following panic in production
BUG: kernel NULL pointer dereference address: 0000000000000065
PGD 2f485f067 P4D 2f485f067 PUD 2cc5d8067 PMD 0
RIP: 0010:ff_layout_cancel_io+0x3a/0x90 [nfs_layout_flexfiles]
Call Trace:
Inspecting the core with drgn I was able to pull this
prog.crashed_thread().stack_trace()[0] 0 at 0xffffffffa079657a (ff_layout_cancel_io+0x3a/0x84) in ff_layout_cancel_io at fs/nfs/flexfilelayout/flexfilelayout.c:2021:27 prog.crashed_thread().stack_trace()[0][‘idx’] (u32)1 prog.crashed_thread().stack_trace()[0][‘flseg’].mirror_array[1].mirror_ds (struct nfs4_ff_layout_ds )0xffffffffffffffed
This is clear from the stack trace we call nfs4_ff_layout_prepare_ds() which could error out initializing the mirror_ds and then we go to clean it all up and our check is only for if (!mirror->mirror_ds). This is inconsistent with the rest of the users of mirror_ds which have
if (IS_ERR_OR_NULL(mirror_ds))
to keep from tripping over this exact scenario. Fix this up in ff_layout_cancel_io() to make sure we don’t panic when we get an error. I also spot checked all the other instances of checking mirror_ds and we appear to be doing the correct checks everywhere only unconditionally dereferencing mirror_ds when we know it would be valid.
Reference
https://git.kernel.org/stable/c/31db25e3141b20e2a76a9f219eeca52e3cab126c https://git.kernel.org/stable/c/7ca651b4ec4a049f5a46a0e5ff921b86b91c47c5 https://git.kernel.org/stable/c/5ada9016b1217498fad876a3d5b07645cc955608 https://git.kernel.org/stable/c/dac068f164ad05b35e7c0be13f138c3f6adca58f https://git.kernel.org/stable/c/719fcafe07c12646691bd62d7f8d94d657fa0766
Share on: