From: "Randall P. Embry" rpembry@gmail.com
[ Upstream commit 528f218b31aac4bbfc58914d43766a22ab545d48 ]
v9fs_sysfs_init() always returned -ENOMEM on failure; return the actual sysfs_create_group() error instead.
Signed-off-by: Randall P. Embry rpembry@gmail.com Message-ID: 20250926-v9fs_misc-v1-3-a8b3907fc04d@codewreck.org Signed-off-by: Dominique Martinet asmadeus@codewreck.org Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES – the change makes `v9fs_sysfs_init()` propagate the real failure code from sysfs instead of always reporting `-ENOMEM`, which corrects user-visible error reporting with negligible risk.
- `fs/9p/v9fs.c:599-609` now stores the `sysfs_create_group()` return value in `ret` and hands it back unchanged; previously every failure was coerced to `-ENOMEM`, masking causes such as `-EEXIST` or `-EINVAL`. - `init_v9fs()` already bubbles that return value to the module loader (`fs/9p/v9fs.c:677-690`), so the bad errno currently confuses anyone diagnosing why the filesystem failed to load; accurate errnos aid automated tooling and human debugging. - No other behaviour changes: the failure path still drops the kobject, and successful initialisation and cleanup remain identical, so regression risk is minimal.
Given it fixes incorrect error propagation in a contained subsystem routine with no interface churn, it aligns well with stable backport criteria.
fs/9p/v9fs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 714cfe76ee651..a59c26cc3c7d9 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -597,13 +597,16 @@ static const struct attribute_group v9fs_attr_group = {
static int __init v9fs_sysfs_init(void) { + int ret; + v9fs_kobj = kobject_create_and_add("9p", fs_kobj); if (!v9fs_kobj) return -ENOMEM;
- if (sysfs_create_group(v9fs_kobj, &v9fs_attr_group)) { + ret = sysfs_create_group(v9fs_kobj, &v9fs_attr_group); + if (ret) { kobject_put(v9fs_kobj); - return -ENOMEM; + return ret; }
return 0;