mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
ksmbd: use scoped_with_init_fs() for share path resolution
Use scoped_with_init_fs() to temporarily override current->fs for the kern_path() call in share_config_request() so the share path lookup happens in init's filesystem context. All ksmbd paths ← SMB command handlers ← handle_ksmbd_work() ← workqueue ← ksmbd_conn_handler_loop() ← kthread Link: https://patch.msgid.link/20260601-work-kthread-nullfs-v4-13-77ee053060e0@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <linux/rwsem.h>
|
||||
#include <linux/parser.h>
|
||||
#include <linux/namei.h>
|
||||
#include <linux/fs_struct.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
@@ -193,7 +194,8 @@ static struct ksmbd_share_config *share_config_request(struct ksmbd_work *work,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = kern_path(share->path, 0, &share->vfs_path);
|
||||
scoped_with_init_fs()
|
||||
ret = kern_path(share->path, 0, &share->vfs_path);
|
||||
ksmbd_revert_fsids(work);
|
||||
if (ret) {
|
||||
ksmbd_debug(SMB, "failed to access '%s'\n",
|
||||
|
||||
Reference in New Issue
Block a user