FAILED: patch "[PATCH] smb: client: do not pass a NULL buf to is_oplock_break()" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 2225ab306575e424b3dad2ee1be2521c89249d15
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026110215-unnatural-hardhead-0088@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2225ab306575e424b3dad2ee1be2521c89249d15 Mon Sep 17 00:00:00 2001
From: Zikang Gao <[email protected]>
Date: Wed, 14 Oct 2026 04:19:44 -0400
Subject: [PATCH] smb: client: do not pass a NULL buf to is_oplock_break()
receive_encrypted_read() sets *num_mids = 1 and never writes the caller's bufs[]. Offload returns -1 with *num_mids = 0, so the demultiplex thread skips the frame. The inline decrypt path returns 0 even when smb2_find_mid() fails.
cifs_demultiplex_thread() then treats mids[i] == NULL as an oplock break and calls is_oplock_break(bufs[i], server) with bufs[i] still NULL. smb2_is_valid_oplock_break() reads hdr.Command at offset 12 and oopses.
A large encrypted READ whose MessageId does not match is enough to panic cifsd.
Oops: general protection fault, probably for non-canonical address
0xdffffc0000000001: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range
[0x0000000000000008-0x000000000000000f]
CPU: 0 PID: 100 Comm: cifsd
RIP: smb2_is_valid_oplock_break+0xc8/0x2270 [cifs]
cifs_demultiplex_thread
Kernel panic - not syncing: Fatal exceptionReturn -1 when inline decrypt finds no mid, and skip is_oplock_break() plus the unknown-frame dump when bufs[i] is NULL. receive_encrypted_standard() already assigns bufs[*num_mids].
fs/smb/client/connect.c +3 -1
@@ -1422,12 +1422,14 @@ cifs_demultiplex_thread(void *p)mid_execute_callback (server, mids[i]);release_mid (server, mids[i]); - }else if (server->ops->is_oplock_break && + }else if (bufs[i] && server->ops->is_oplock_break && server->ops->is_oplock_break (bufs[i], server)) {smb2_add_credits_from_hdr (bufs[i], server);cifs_dbg (FYI ,"Received oplock break\n" ); }else { +if (!bufs[i]) +continue ;cifs_server_dbg (VFS ,"No task to wake, unknown frame received! NumMids %d\n" ,atomic_read (&mid_count)); cifs_dump_mem("Received Data is: ", bufs[i],
fs/smb/client/smb2ops.c +1 -0
@@ -5396,6 +5396,7 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid, *mid =smb2_find_mid (server, buf);if (*mid ==NULL ) {cifs_dbg (FYI ,"mid not found\n" ); + rc =-1 ; }else {cifs_dbg (FYI ,"mid found\n" ); (*mid)->decrypted = true;
Sasha Levin
maintainerPATCH 1/1 smb: client: do not pass a NULL buf to is_oplock_break()
From: Zikang Gao <[email protected]>
[ Upstream commit 2225ab306575e424b3dad2ee1be2521c89249d15 ]
receive_encrypted_read() sets *num_mids = 1 and never writes the caller's bufs[]. Offload returns -1 with *num_mids = 0, so the demultiplex thread skips the frame. The inline decrypt path returns 0 even when smb2_find_mid() fails.
cifs_demultiplex_thread() then treats mids[i] == NULL as an oplock break and calls is_oplock_break(bufs[i], server) with bufs[i] still NULL. smb2_is_valid_oplock_break() reads hdr.Command at offset 12 and oopses.
A large encrypted READ whose MessageId does not match is enough to panic cifsd.
Oops: general protection fault, probably for non-canonical address
0xdffffc0000000001: 0000 [#1] SMP KASAN PTI
KASAN: null-ptr-deref in range
[0x0000000000000008-0x000000000000000f]
CPU: 0 PID: 100 Comm: cifsd
RIP: smb2_is_valid_oplock_break+0xc8/0x2270 [cifs]
cifs_demultiplex_thread
Kernel panic - not syncing: Fatal exceptionReturn -1 when inline decrypt finds no mid, and skip is_oplock_break() plus the unknown-frame dump when bufs[i] is NULL. receive_encrypted_standard() already assigns bufs[*num_mids].
--- fs/cifs/connect.c | 4 +++- fs/cifs/smb2ops.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)
fs/cifs/connect.c +3 -1
@@ -1089,12 +1089,14 @@ cifs_demultiplex_thread(void *p) mids[i]->callback (mids[i]);cifs_mid_q_entry_release (mids[i]); - }else if (server->ops->is_oplock_break && + }else if (bufs[i] && server->ops->is_oplock_break && server->ops->is_oplock_break (bufs[i], server)) {smb2_add_credits_from_hdr (bufs[i], server);cifs_dbg (FYI ,"Received oplock break\n" ); }else { +if (!bufs[i]) +continue ;cifs_server_dbg (VFS ,"No task to wake, unknown frame received! NumMids %d\n" ,atomic_read (&midCount)); cifs_dump_mem("Received Data is: ", bufs[i],
fs/cifs/smb2ops.c +3 -2
@@ -5208,9 +5208,10 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid, goto free_pages; *mid =smb2_find_mid (server, buf); -if (*mid ==NULL ) +if (*mid ==NULL ) {cifs_dbg (FYI ,"mid not found\n" ); -else { + rc =-1 ; + }else {cifs_dbg (FYI ,"mid found\n" ); (*mid)->decrypted = true; rc = handle_read_data(server, *mid, buf,
Signature · 1 line
2.53.0