[PATCH] scsi: target: reject configfs db_root for ALUA metadata
From: Runyu Xiao
Date: Tue Aug 18 2026 - 00:28:00 EST
The db_root configfs attribute only validates that the supplied path
resolves to a directory. Later ALUA metadata writes build file names
under db_root and open them with filp_open().
If db_root itself points at a configfs mount, an ALUA transition that
updates metadata can re-enter configfs through that filp_open() path
while configfs is still servicing the original store. That makes the
metadata path recurse back into the same frag_sem.
Reject configfs-backed db_root values in target_core_item_dbroot_store()
so later metadata users keep running on a normal filesystem instead of
re-entering configfs.
Fixes: a96e9783e058 ("target: make target db location configurable")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Runyu Xiao <runyu.xiao@xxxxxxxxxx>
---
drivers/target/target_core_configfs.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index a2bd2e8..5ee6f9c 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -138,8 +138,16 @@ static ssize_t target_core_item_dbroot_store(struct config_item *item,
pr_err("db_root: not a directory: %s\n", db_root_stage);
goto unlock;
}
+ if (!strcmp(path.dentry->d_sb->s_type->name, "configfs")) {
+ pr_err("db_root: configfs is not a valid target database root: %s\n",
+ db_root_stage);
+ r = -EINVAL;
+ }
path_put(&path);
+ if (r)
+ goto unlock;
+
strscpy(db_root, db_root_stage);
pr_debug("Target_Core_ConfigFS: db_root set to %s\n", db_root);
--
2.34.1