From: ZhangGuoDong <zhang.guodong@linux.dev>
To: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org,
ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
bharathsm@microsoft.com, senozhatsky@chromium.org,
dhowells@redhat.com, metze@samba.org
Cc: linux-cifs@vger.kernel.org,
ZhangGuoDong <zhangguodong@kylinos.cn>,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH 3/6] smb/server: fix invalid pointer dereference in ksmbd_stop_durable_scavenger()
Date: Fri, 31 Jul 2026 11:50:05 +0000 [thread overview]
Message-ID: <20260731115008.111211-4-zhang.guodong@linux.dev> (raw)
In-Reply-To: <20260731115008.111211-1-zhang.guodong@linux.dev>
From: ZhangGuoDong <zhangguodong@kylinos.cn>
See the procedure below:
ksmbd_launch_ksmbd_durable_scavenger
durable_scavenger_running = true
server_conf.dh_task = kthread_run() // fail, dh_task is an ERR_PTR()
server_ctrl_handle_reset
ksmbd_stop_durable_scavenger
kthread_stop(server_conf.dh_task) // invalid pointer
Fixes: d484d621d40f ("ksmbd: add durable scavenger timer")
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
fs/smb/server/vfs_cache.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
index 5acd06020d42..a35df2ab59c9 100644
--- a/fs/smb/server/vfs_cache.c
+++ b/fs/smb/server/vfs_cache.c
@@ -1618,9 +1618,12 @@ void ksmbd_launch_ksmbd_durable_scavenger(void)
server_conf.dh_task = kthread_run(ksmbd_durable_scavenger,
(void *)NULL, "ksmbd-durable-scavenger");
- if (IS_ERR(server_conf.dh_task))
+ if (IS_ERR(server_conf.dh_task)) {
pr_err("cannot start conn thread, err : %ld\n",
PTR_ERR(server_conf.dh_task));
+ server_conf.dh_task = NULL;
+ durable_scavenger_running = false;
+ }
mutex_unlock(&durable_scavenger_lock);
}
--
2.54.0
next prev parent reply other threads:[~2026-07-31 11:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 11:50 [PATCH 0/6] ksmbd: fix some bugs ZhangGuoDong
2026-07-31 11:50 ` [PATCH 1/6] smb/server: fix null-ptr-deref in ksmbd_ipc_tree_connect_request() ZhangGuoDong
2026-07-31 11:50 ` [PATCH 2/6] smb/server: fix memory leak in ksmbd_vfs_set_durable_owner() ZhangGuoDong
2026-07-31 11:50 ` ZhangGuoDong [this message]
2026-07-31 11:50 ` [PATCH 4/6] smb/server: abort initialization when proc setup fails ZhangGuoDong
2026-07-31 11:50 ` [PATCH 5/6] smb/server: call ksmbd_proc_cleanup() on module init failure ZhangGuoDong
2026-07-31 11:50 ` [PATCH 6/6] smb/server: preserve error status in smb2_handle_negotiate() ZhangGuoDong
2026-08-01 2:10 ` [PATCH 0/6] ksmbd: fix some bugs Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260731115008.111211-4-zhang.guodong@linux.dev \
--to=zhang.guodong@linux.dev \
--cc=bharathsm@microsoft.com \
--cc=chenxiaosong@kylinos.cn \
--cc=dhowells@redhat.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=metze@samba.org \
--cc=pc@manguebit.org \
--cc=ronniesahlberg@gmail.com \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
--cc=zhangguodong@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox