* [PATCH v2] ovl: Add comment on upperredirect reassignment
@ 2022-08-31 8:06 Stanislav Goriainov
0 siblings, 0 replies; only message in thread
From: Stanislav Goriainov @ 2022-08-31 8:06 UTC (permalink / raw)
To: Miklos Szeredi
Cc: Stanislav Goriainov, Vivek Goyal, Amir Goldstein, linux-unionfs,
linux-kernel, ldv-project
If memory for uperredirect was allocated with kstrdup()
in upperdir != NULL and d.redirect != NULL path, it may seem
that it can be lost when upperredirect is reassigned later, but
it's not possible.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 0a2d0d3f2f291 ("ovl: Check redirect on index as well")
Signed-off-by: Stanislav Goriainov <goriainov@ispras.ru>
---
fs/overlayfs/namei.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 69dc577974f8..2a21331e6ccd 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -1085,6 +1085,11 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
.mnt = ovl_upper_mnt(ofs),
};
+ /* There is no overwrite of upperredirect here as the first
+ * assignment of upperredirect happens only if
+ * upperdentry is non-NULL, while here we are only
+ * if upperdentry is NULL.
+ */
upperredirect = ovl_get_redirect_xattr(ofs, &upperpath, 0);
if (IS_ERR(upperredirect)) {
err = PTR_ERR(upperredirect);
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-31 8:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 8:06 [PATCH v2] ovl: Add comment on upperredirect reassignment Stanislav Goriainov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).