diff options
author | Chengguang Xu | 2021-03-01 14:19:30 +0800 |
---|---|---|
committer | Miklos Szeredi | 2021-04-12 12:00:36 +0200 |
commit | d7b49b10d5a92f22333a3800dfae89ea0822751b (patch) | |
tree | 9088a2b3e82981491883a330b94e442f57a001f4 /fs/overlayfs | |
parent | 7b279bbfd2b230c7a210ff8f405799c7e46bbf48 (diff) |
ovl: fix error for ovl_fill_super()
There are some places should return -EINVAL instead of -ENOMEM in
ovl_fill_super().
[Amir] Consistently set error before checking the error condition.
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs')
-rw-r--r-- | fs/overlayfs/super.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 5fcaf3acc350..3f6333b32797 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1981,6 +1981,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) if (!ofs) goto out; + err = -ENOMEM; ofs->creator_cred = cred = prepare_creds(); if (!cred) goto out_err; @@ -2009,6 +2010,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) if (!splitlower) goto out_err; + err = -EINVAL; numlower = ovl_split_lowerdirs(splitlower); if (numlower > OVL_MAX_STACK) { pr_err("too many lower directories, limit is %d\n", @@ -2016,6 +2018,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) goto out_err; } + err = -ENOMEM; layers = kcalloc(numlower + 1, sizeof(struct ovl_layer), GFP_KERNEL); if (!layers) goto out_err; @@ -2042,6 +2045,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) if (ofs->config.upperdir) { struct super_block *upper_sb; + err = -EINVAL; if (!ofs->config.workdir) { pr_err("missing 'workdir'\n"); goto out_err; |