summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall P. Embry <rpembry@gmail.com>2025-09-26 18:27:30 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-03 12:45:14 +0100
commit1831e39b09ce5d9368a7750a217214666ddae55b (patch)
tree1e60fc1b596c0f5cec03bdb79b776ccd6a6f3c2b
parent4c821ffa2ab5ef4f5bb9fb37f8902a9d990981fe (diff)
9p: fix /sys/fs/9p/caches overwriting itself
[ Upstream commit 86db0c32f16c5538ddb740f54669ace8f3a1f3d7 ] caches_show() overwrote its buffer on each iteration, so only the last cache tag was visible in sysfs output. Properly append with snprintf(buf + count, …). Signed-off-by: Randall P. Embry <rpembry@gmail.com> Message-ID: <20250926-v9fs_misc-v1-2-a8b3907fc04d@codewreck.org> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/9p/v9fs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 39def020a074..b304e070139c 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -558,7 +558,7 @@ static ssize_t caches_show(struct kobject *kobj,
spin_lock(&v9fs_sessionlist_lock);
list_for_each_entry(v9ses, &v9fs_sessionlist, slist) {
if (v9ses->cachetag) {
- n = snprintf(buf, limit, "%s\n", v9ses->cachetag);
+ n = snprintf(buf + count, limit, "%s\n", v9ses->cachetag);
if (n < 0) {
count = n;
break;