Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Stable-dep-of: 0d5a4f8f775f ("fs: Fix error checking for d_hash_and_lookup()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- fs/cifs/cifsfs.c | 7 +------
- fs/debugfs/inode.c | 6 +-----
- fs/kernfs/mount.c | 2 +-
- fs/namei.c | 20 ++++++++++++++++++++
- fs/nfsd/nfs3xdr.c | 4 +---
- fs/nfsd/nfs4xdr.c | 11 +----------
- fs/overlayfs/namei.c | 24 ++++++++----------------
- fs/quota/dquot.c | 7 +------
- include/linux/namei.h | 1 +
- 9 files changed, 35 insertions(+), 47 deletions(-)
+ fs/cifs/cifsfs.c | 7 +------
+ fs/debugfs/inode.c | 6 +-----
+ fs/kernfs/mount.c | 2 +-
+ fs/namei.c | 20 ++++++++++++++++++++
+ fs/nfsd/nfs3xdr.c | 4 +---
+ fs/nfsd/nfs4xdr.c | 11 +----------
+ fs/overlayfs/namei.c | 24 ++++++++----------------
+ fs/quota/dquot.c | 8 +-------
+ include/linux/namei.h | 1 +
+ 9 files changed, 35 insertions(+), 48 deletions(-)
-diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
-index 52b1524b40cdc..ef1a43f4bd663 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
-@@ -663,11 +663,6 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
+@@ -663,11 +663,6 @@ cifs_get_root(struct smb_vol *vol, struc
struct inode *dir = d_inode(dentry);
struct dentry *child;
if (!S_ISDIR(dir->i_mode)) {
dput(dentry);
dentry = ERR_PTR(-ENOTDIR);
-@@ -684,7 +679,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
+@@ -684,7 +679,7 @@ cifs_get_root(struct smb_vol *vol, struc
while (*s && *s != sep)
s++;
dput(dentry);
dentry = child;
} while (!IS_ERR(dentry));
-diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
-index 4661ecaf6741c..1e4ae78f64a8f 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
-@@ -275,13 +275,9 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
+@@ -275,13 +275,9 @@ struct dentry *debugfs_lookup(const char
if (!parent)
parent = debugfs_mount->mnt_root;
return dentry;
}
EXPORT_SYMBOL_GPL(debugfs_lookup);
-diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
-index 0b22c39dad477..b2a126a947e31 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
-@@ -212,7 +212,7 @@ struct dentry *kernfs_node_dentry(struct kernfs_node *kn,
+@@ -212,7 +212,7 @@ struct dentry *kernfs_node_dentry(struct
dput(dentry);
return ERR_PTR(-EINVAL);
}
strlen(kntmp->name));
dput(dentry);
if (IS_ERR(dtmp))
-diff --git a/fs/namei.c b/fs/namei.c
-index 9e8fca598acc5..0dbe38afef29b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
-@@ -2575,6 +2575,26 @@ struct dentry *lookup_one_len_unlocked(const char *name,
+@@ -2575,6 +2575,26 @@ struct dentry *lookup_one_len_unlocked(c
}
EXPORT_SYMBOL(lookup_one_len_unlocked);
#ifdef CONFIG_UNIX98_PTYS
int path_pts(struct path *path)
{
-diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
-index b90bea1c434eb..9f537decdd9c7 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
-@@ -855,13 +855,11 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
+@@ -855,13 +855,11 @@ compose_entry_fh(struct nfsd3_readdirres
} else
dchild = dget(dparent);
} else
if (dchild->d_inode->i_ino != ino)
goto out;
rv = fh_compose(fhp, exp, dchild, &cd->fh);
-diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
-index 74ab20c89e752..bceb99a8a814a 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
-@@ -2984,18 +2984,9 @@ nfsd4_encode_dirent_fattr(struct xdr_stream *xdr, struct nfsd4_readdir *cd,
+@@ -2984,18 +2984,9 @@ nfsd4_encode_dirent_fattr(struct xdr_str
__be32 nfserr;
int ignore_crossmnt = 0;
exp_get(exp);
/*
-diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
-index badf039267a2f..e51dc7f16596c 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
-@@ -203,7 +203,7 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
+@@ -203,7 +203,7 @@ static int ovl_lookup_single(struct dent
int err;
bool last_element = !post[0];
if (IS_ERR(this)) {
err = PTR_ERR(this);
this = NULL;
-@@ -211,8 +211,6 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
+@@ -211,8 +211,6 @@ static int ovl_lookup_single(struct dent
goto out;
goto out_err;
}
if (ovl_dentry_weird(this)) {
/* Don't support traversing automounts and other weirdness */
-@@ -654,7 +652,7 @@ struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh)
+@@ -654,7 +652,7 @@ struct dentry *ovl_get_index_fh(struct o
if (err)
return ERR_PTR(err);
kfree(name.name);
if (IS_ERR(index)) {
if (PTR_ERR(index) == -ENOENT)
-@@ -662,9 +660,7 @@ struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh)
+@@ -662,9 +660,7 @@ struct dentry *ovl_get_index_fh(struct o
return index;
}
err = -ESTALE;
else if (ovl_dentry_weird(index))
err = -EIO;
-@@ -688,7 +684,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper,
+@@ -688,7 +684,7 @@ struct dentry *ovl_lookup_index(struct o
if (err)
return ERR_PTR(err);
if (IS_ERR(index)) {
err = PTR_ERR(index);
if (err == -ENOENT) {
-@@ -703,9 +699,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper,
+@@ -703,9 +699,7 @@ struct dentry *ovl_lookup_index(struct o
}
inode = d_inode(index);
/*
* When index lookup is called with !verify for decoding an
* overlay file handle, a whiteout index implies that decode
-@@ -1134,7 +1128,7 @@ bool ovl_lower_positive(struct dentry *dentry)
+@@ -1134,7 +1128,7 @@ bool ovl_lower_positive(struct dentry *d
struct dentry *this;
struct dentry *lowerdir = poe->lowerstack[i].dentry;
name->len);
if (IS_ERR(this)) {
switch (PTR_ERR(this)) {
-@@ -1151,10 +1145,8 @@ bool ovl_lower_positive(struct dentry *dentry)
+@@ -1151,10 +1145,8 @@ bool ovl_lower_positive(struct dentry *d
break;
}
} else {
dput(this);
}
}
-diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
-index 303987d29b9c9..d901119e25b51 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
-@@ -2535,15 +2535,10 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
+@@ -2535,21 +2535,15 @@ int dquot_quota_on_mount(struct super_bl
struct dentry *dentry;
int error;
error = security_quota_on(dentry);
if (!error)
error = vfs_load_quota_inode(d_inode(dentry), type, format_id,
-diff --git a/include/linux/namei.h b/include/linux/namei.h
-index a78606e8e3df7..4632f4ca33426 100644
+ DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
+-out:
+ dput(dentry);
+ return error;
+ }
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
-@@ -84,6 +84,7 @@ extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
+@@ -84,6 +84,7 @@ extern int kern_path_mountpoint(int, con
extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int);
extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int);
extern int follow_down_one(struct path *);
extern int follow_down(struct path *);
---
-2.40.1
-
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Stable-dep-of: 0d5a4f8f775f ("fs: Fix error checking for d_hash_and_lookup()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- fs/cifs/cifsfs.c | 7 +------
- fs/debugfs/inode.c | 6 +-----
- fs/kernfs/mount.c | 2 +-
- fs/namei.c | 20 ++++++++++++++++++++
- fs/nfsd/nfs3xdr.c | 4 +---
- fs/nfsd/nfs4xdr.c | 11 +----------
- fs/overlayfs/namei.c | 24 ++++++++----------------
- fs/quota/dquot.c | 7 +------
- include/linux/namei.h | 1 +
- 9 files changed, 35 insertions(+), 47 deletions(-)
+ fs/cifs/cifsfs.c | 7 +------
+ fs/debugfs/inode.c | 6 +-----
+ fs/kernfs/mount.c | 2 +-
+ fs/namei.c | 20 ++++++++++++++++++++
+ fs/nfsd/nfs3xdr.c | 4 +---
+ fs/nfsd/nfs4xdr.c | 11 +----------
+ fs/overlayfs/namei.c | 24 ++++++++----------------
+ fs/quota/dquot.c | 8 +-------
+ include/linux/namei.h | 1 +
+ 9 files changed, 35 insertions(+), 48 deletions(-)
-diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
-index 871a7b044c1b8..b6149952ab846 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
-@@ -738,11 +738,6 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
+@@ -738,11 +738,6 @@ cifs_get_root(struct smb_vol *vol, struc
struct inode *dir = d_inode(dentry);
struct dentry *child;
if (!S_ISDIR(dir->i_mode)) {
dput(dentry);
dentry = ERR_PTR(-ENOTDIR);
-@@ -759,7 +754,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
+@@ -759,7 +754,7 @@ cifs_get_root(struct smb_vol *vol, struc
while (*s && *s != sep)
s++;
dput(dentry);
dentry = child;
} while (!IS_ERR(dentry));
-diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
-index e0f07382ebebc..258230f4e4855 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
-@@ -299,13 +299,9 @@ struct dentry *debugfs_lookup(const char *name, struct dentry *parent)
+@@ -299,13 +299,9 @@ struct dentry *debugfs_lookup(const char
if (!parent)
parent = debugfs_mount->mnt_root;
return dentry;
}
EXPORT_SYMBOL_GPL(debugfs_lookup);
-diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
-index 6c12fac2c2878..d62cec6d838d6 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
-@@ -200,7 +200,7 @@ struct dentry *kernfs_node_dentry(struct kernfs_node *kn,
+@@ -200,7 +200,7 @@ struct dentry *kernfs_node_dentry(struct
dput(dentry);
return ERR_PTR(-EINVAL);
}
strlen(kntmp->name));
dput(dentry);
if (IS_ERR(dtmp))
-diff --git a/fs/namei.c b/fs/namei.c
-index 14e600711f504..21988d22399f9 100644
--- a/fs/namei.c
+++ b/fs/namei.c
-@@ -2565,6 +2565,26 @@ struct dentry *lookup_one_len_unlocked(const char *name,
+@@ -2565,6 +2565,26 @@ struct dentry *lookup_one_len_unlocked(c
}
EXPORT_SYMBOL(lookup_one_len_unlocked);
#ifdef CONFIG_UNIX98_PTYS
int path_pts(struct path *path)
{
-diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
-index 8f077e66e613f..03e8c45a52f3c 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
-@@ -868,13 +868,11 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
+@@ -868,13 +868,11 @@ compose_entry_fh(struct nfsd3_readdirres
} else
dchild = dget(dparent);
} else
if (dchild->d_inode->i_ino != ino)
goto out;
rv = fh_compose(fhp, exp, dchild, &cd->fh);
-diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
-index ff95a08574721..3d7b0ad4157df 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
-@@ -2991,18 +2991,9 @@ nfsd4_encode_dirent_fattr(struct xdr_stream *xdr, struct nfsd4_readdir *cd,
+@@ -2991,18 +2991,9 @@ nfsd4_encode_dirent_fattr(struct xdr_str
__be32 nfserr;
int ignore_crossmnt = 0;
exp_get(exp);
/*
-diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
-index f47c591402d76..625da4bc8d0fc 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
-@@ -200,7 +200,7 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
+@@ -200,7 +200,7 @@ static int ovl_lookup_single(struct dent
int err;
bool last_element = !post[0];
if (IS_ERR(this)) {
err = PTR_ERR(this);
this = NULL;
-@@ -208,8 +208,6 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
+@@ -208,8 +208,6 @@ static int ovl_lookup_single(struct dent
goto out;
goto out_err;
}
if (ovl_dentry_weird(this)) {
/* Don't support traversing automounts and other weirdness */
-@@ -659,7 +657,7 @@ struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh)
+@@ -659,7 +657,7 @@ struct dentry *ovl_get_index_fh(struct o
if (err)
return ERR_PTR(err);
kfree(name.name);
if (IS_ERR(index)) {
if (PTR_ERR(index) == -ENOENT)
-@@ -667,9 +665,7 @@ struct dentry *ovl_get_index_fh(struct ovl_fs *ofs, struct ovl_fh *fh)
+@@ -667,9 +665,7 @@ struct dentry *ovl_get_index_fh(struct o
return index;
}
err = -ESTALE;
else if (ovl_dentry_weird(index))
err = -EIO;
-@@ -693,7 +689,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper,
+@@ -693,7 +689,7 @@ struct dentry *ovl_lookup_index(struct o
if (err)
return ERR_PTR(err);
if (IS_ERR(index)) {
err = PTR_ERR(index);
if (err == -ENOENT) {
-@@ -708,9 +704,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper,
+@@ -708,9 +704,7 @@ struct dentry *ovl_lookup_index(struct o
}
inode = d_inode(index);
/*
* When index lookup is called with !verify for decoding an
* overlay file handle, a whiteout index implies that decode
-@@ -1139,7 +1133,7 @@ bool ovl_lower_positive(struct dentry *dentry)
+@@ -1139,7 +1133,7 @@ bool ovl_lower_positive(struct dentry *d
struct dentry *this;
struct dentry *lowerdir = poe->lowerstack[i].dentry;
name->len);
if (IS_ERR(this)) {
switch (PTR_ERR(this)) {
-@@ -1156,10 +1150,8 @@ bool ovl_lower_positive(struct dentry *dentry)
+@@ -1156,10 +1150,8 @@ bool ovl_lower_positive(struct dentry *d
break;
}
} else {
dput(this);
}
}
-diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
-index 3d1a71d2909bb..5361e6bc397d0 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
-@@ -2543,15 +2543,10 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
+@@ -2543,21 +2543,15 @@ int dquot_quota_on_mount(struct super_bl
struct dentry *dentry;
int error;
error = security_quota_on(dentry);
if (!error)
error = vfs_load_quota_inode(d_inode(dentry), type, format_id,
-diff --git a/include/linux/namei.h b/include/linux/namei.h
-index 397a08ade6a21..7fe7b87a3ded9 100644
+ DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
+
+-out:
+ dput(dentry);
+ return error;
+ }
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
-@@ -60,6 +60,7 @@ extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int);
+@@ -60,6 +60,7 @@ extern int kern_path_mountpoint(int, con
extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int);
extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int);
extern int follow_down_one(struct path *);
extern int follow_down(struct path *);
---
-2.40.1
-