[PATCH v2 4/4] fs: legacy: return an error pointer from legacy_get_link()
Sascha Hauer
s.hauer at pengutronix.de
Mon Nov 2 01:31:23 PST 2026
legacy_get_link() returns NULL when the driver's readlink fails, but
readlinkat() checks the returned link only with IS_ERR() before copying
from it, and path lookup takes NULL to mean that the link has already
been followed. Return the driver's error as an error pointer instead,
like legacy_get_link() already does when there is no readlink.
Fixes: b3fbfad7ae ("fs: dentry cache implementation")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
fs/legacy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/legacy.c b/fs/legacy.c
index dce14706ca..07381d2b5f 100644
--- a/fs/legacy.c
+++ b/fs/legacy.c
@@ -289,7 +289,7 @@ static const char *legacy_get_link(struct dentry *dentry, struct inode *inode)
free(pathname);
if (ret)
- return NULL;
+ return ERR_PTR(ret);
inode->i_link = xstrdup(link);
--
2.47.3
More information about the barebox
mailing list