Skip to content

Commit

Permalink
ovl: fix return value of ovl_fill_super
Browse files Browse the repository at this point in the history
If kcalloc() failed, the return value of ovl_fill_super() is -EINVAL,
not -ENOMEM. So this patch sets this value to -ENOMEM before calling
kcalloc(), and sets it back to -EINVAL after calling kcalloc().

Signed-off-by: Geliang Tang <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
  • Loading branch information
geliangtang authored and Miklos Szeredi committed Dec 16, 2016
1 parent 32a3d84 commit 313684c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/overlayfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,12 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
goto out_free_lowertmp;
}

err = -ENOMEM;
stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL);
if (!stack)
goto out_free_lowertmp;

err = -EINVAL;
lower = lowertmp;
for (numlower = 0; numlower < stacklen; numlower++) {
err = ovl_lower_dir(lower, &stack[numlower], ufs,
Expand Down

0 comments on commit 313684c

Please sign in to comment.