* [PATCH] ovl: fix missing revert_creds() on error path
@ 2021-03-23 13:19 Dan Carpenter
2021-03-29 14:14 ` Miklos Szeredi
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-03-23 13:19 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: Amir Goldstein, linux-unionfs, kernel-janitors
Smatch complains about missing that the ovl_override_creds() doesn't
have a matching revert_creds() if the dentry is disconnected. Fix this
by moving the ovl_override_creds() until after the disconnected check.
Fixes: aa3ff3c152ff ("ovl: copy up of disconnected dentries")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
fs/overlayfs/copy_up.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 0b2891c6c71e..2846b943e80c 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -932,7 +932,7 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
static int ovl_copy_up_flags(struct dentry *dentry, int flags)
{
int err = 0;
- const struct cred *old_cred = ovl_override_creds(dentry->d_sb);
+ const struct cred *old_cred;
bool disconnected = (dentry->d_flags & DCACHE_DISCONNECTED);
/*
@@ -943,6 +943,7 @@ static int ovl_copy_up_flags(struct dentry *dentry, int flags)
if (WARN_ON(disconnected && d_is_dir(dentry)))
return -EIO;
+ old_cred = ovl_override_creds(dentry->d_sb);
while (!err) {
struct dentry *next;
struct dentry *parent = NULL;
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ovl: fix missing revert_creds() on error path
2021-03-23 13:19 [PATCH] ovl: fix missing revert_creds() on error path Dan Carpenter
@ 2021-03-29 14:14 ` Miklos Szeredi
0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2021-03-29 14:14 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Amir Goldstein, overlayfs, kernel-janitors
On Tue, Mar 23, 2021 at 2:19 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Smatch complains about missing that the ovl_override_creds() doesn't
> have a matching revert_creds() if the dentry is disconnected. Fix this
> by moving the ovl_override_creds() until after the disconnected check.
>
> Fixes: aa3ff3c152ff ("ovl: copy up of disconnected dentries")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks, applied.
Miklos
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-29 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 13:19 [PATCH] ovl: fix missing revert_creds() on error path Dan Carpenter
2021-03-29 14:14 ` Miklos Szeredi
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).