From c3f4513c7828f9e0b74d7a25bb1995f96d2d8a57 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 1 Jun 2026 15:56:42 +0200 Subject: [PATCH] scsi: target: use scoped_with_init_fs() for APTPL metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use scoped_with_init_fs() to temporarily override current->fs for the filp_open() call in __core_scsi3_write_aptpl_to_file() so the path lookup happens in init's filesystem context. __core_scsi3_write_aptpl_to_file() ← core_scsi3_update_and_write_aptpl() ← PR command handlers ← target_queued_submit_work() ← kworker Link: https://patch.msgid.link/20260601-work-kthread-nullfs-v4-9-77ee053060e0@kernel.org Signed-off-by: Christian Brauner (Amutable) --- drivers/target/target_core_pr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 11790f2c5d80..cfd949e7a095 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -1969,7 +1970,8 @@ static int __core_scsi3_write_aptpl_to_file( if (!path) return -ENOMEM; - file = filp_open(path, flags, 0600); + scoped_with_init_fs() + file = filp_open(path, flags, 0600); if (IS_ERR(file)) { pr_err("filp_open(%s) for APTPL metadata" " failed\n", path);