summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2018-10-10 19:10:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-21 09:24:04 +0100
commit0afa17be1a78bf35085bffb7d0e04b96b766f3ba (patch)
treeb74631bb1ca2e84e923a21e3bd243277cd765268 /fs/overlayfs
parenta8c254d8e96032d5bb235cb2e777203d9acda09d (diff)
downloadlinux-stable-0afa17be1a78bf35085bffb7d0e04b96b766f3ba.tar.gz
linux-stable-0afa17be1a78bf35085bffb7d0e04b96b766f3ba.tar.bz2
linux-stable-0afa17be1a78bf35085bffb7d0e04b96b766f3ba.zip
ovl: fix error handling in ovl_verify_set_fh()
commit babf4770be0adc69e6d2de150f4040f175e24beb upstream. We hit a BUG on kfree of an ERR_PTR()... Reported-by: syzbot+ff03fe05c717b82502d0@syzkaller.appspotmail.com Fixes: 8b88a2e64036 ("ovl: verify upper root dir matches lower root dir") Cc: <stable@vger.kernel.org> # v4.13 Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r--fs/overlayfs/namei.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index d9468de3c951..8442f9839c90 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -368,8 +368,10 @@ int ovl_verify_origin(struct dentry *dentry, struct vfsmount *mnt,
fh = ovl_encode_fh(origin, is_upper);
err = PTR_ERR(fh);
- if (IS_ERR(fh))
+ if (IS_ERR(fh)) {
+ fh = NULL;
goto fail;
+ }
err = ovl_verify_origin_fh(dentry, fh);
if (set && err == -ENODATA)