diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-06-01 15:56:42 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-06-29 10:44:07 +0200 |
| commit | c3f4513c7828f9e0b74d7a25bb1995f96d2d8a57 (patch) | |
| tree | 30170f98c9bff27214aff318d43bbf68f2e678f5 | |
| parent | 6247acf21a3af61a333d28b5d533424c68d08e08 (diff) | |
| download | linux-stable-c3f4513c7828f9e0b74d7a25bb1995f96d2d8a57.tar.gz linux-stable-c3f4513c7828f9e0b74d7a25bb1995f96d2d8a57.zip | |
scsi: target: use scoped_with_init_fs() for APTPL metadata
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) <brauner@kernel.org>
| -rw-r--r-- | drivers/target/target_core_pr.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 <linux/file.h> #include <linux/fcntl.h> #include <linux/fs.h> +#include <linux/fs_struct.h> #include <scsi/scsi_proto.h> #include <linux/unaligned.h> @@ -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); |
