Skip to content

Commit

Permalink
ovl: fix error handling in ovl_verify_set_fh()
Browse files Browse the repository at this point in the history
commit babf4770be0adc69e6d2de150f4040f175e24beb upstream.

We hit a BUG on kfree of an ERR_PTR()...

Reported-by: [email protected]
Fixes: 8b88a2e ("ovl: verify upper root dir matches lower root dir")
Cc: <[email protected]> # v4.13
Signed-off-by: Amir Goldstein <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
amir73il authored and gregkh committed Nov 21, 2018
1 parent c8099db commit 37403ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/overlayfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,10 @@ int ovl_verify_set_fh(struct dentry *dentry, const char *name,

fh = ovl_encode_real_fh(real, is_upper);
err = PTR_ERR(fh);
if (IS_ERR(fh))
if (IS_ERR(fh)) {
fh = NULL;
goto fail;
}

err = ovl_verify_fh(dentry, name, fh);
if (set && err == -ENODATA)
Expand Down

0 comments on commit 37403ba

Please sign in to comment.