ovl: fix lookup error handling
Amir Goldstein
maintainerPATCH 1/1 ovl: fix lookup error handling
In ovl_lookup_single(), if lookup in undelying fs returned an error that is neither -ENAMETOOLONG nor -ENOENT, PTR_ERR() was returned in *ret as a valid dentry and function returned 0 for success.
The faulty dentry would then be passed to dput() on umount and cause a unhandled kernel page fault.
Signed-off-by Amir Goldstein <[email protected]>
--- fs/overlayfs/namei.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/overlayfs/namei.c +4 -3
@@ -45,11 +45,12 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d, this =lookup_one_len_unlocked (name, base, namelen);if (IS_ERR (this)) { -if (PTR_ERR (this) == -ENOENT || -PTR_ERR (this) == -ENAMETOOLONG ) { + err =PTR_ERR (this); +if (err == -ENOENT || err == -ENAMETOOLONG ) { this =NULL ; + goto out; } - goto out; +return err; }if (!this->d_inode) goto put_and_out;
Signature · 1 line
2.7.4