mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
ovl: fix missing revert_creds() on error path
commit7b279bbfd2upstream. 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:aa3ff3c152("ovl: copy up of disconnected dentries") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7604978e85
commit
06f414e5c9
|
|
@ -928,7 +928,7 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
|
||||||
static int ovl_copy_up_flags(struct dentry *dentry, int flags)
|
static int ovl_copy_up_flags(struct dentry *dentry, int flags)
|
||||||
{
|
{
|
||||||
int err = 0;
|
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);
|
bool disconnected = (dentry->d_flags & DCACHE_DISCONNECTED);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -939,6 +939,7 @@ static int ovl_copy_up_flags(struct dentry *dentry, int flags)
|
||||||
if (WARN_ON(disconnected && d_is_dir(dentry)))
|
if (WARN_ON(disconnected && d_is_dir(dentry)))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
old_cred = ovl_override_creds(dentry->d_sb);
|
||||||
while (!err) {
|
while (!err) {
|
||||||
struct dentry *next;
|
struct dentry *next;
|
||||||
struct dentry *parent = NULL;
|
struct dentry *parent = NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user