Skip to content
Snippets Groups Projects
Commit d7b49b10 authored by Chengguang Xu's avatar Chengguang Xu Committed by Miklos Szeredi
Browse files

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: default avatarChengguang Xu <cgxu519@mykernel.net>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 7b279bbf
No related branches found
No related tags found
No related merge requests found
...@@ -1981,6 +1981,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1981,6 +1981,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
if (!ofs) if (!ofs)
goto out; goto out;
err = -ENOMEM;
ofs->creator_cred = cred = prepare_creds(); ofs->creator_cred = cred = prepare_creds();
if (!cred) if (!cred)
goto out_err; goto out_err;
...@@ -2009,6 +2010,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2009,6 +2010,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
if (!splitlower) if (!splitlower)
goto out_err; goto out_err;
err = -EINVAL;
numlower = ovl_split_lowerdirs(splitlower); numlower = ovl_split_lowerdirs(splitlower);
if (numlower > OVL_MAX_STACK) { if (numlower > OVL_MAX_STACK) {
pr_err("too many lower directories, limit is %d\n", 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) ...@@ -2016,6 +2018,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
goto out_err; goto out_err;
} }
err = -ENOMEM;
layers = kcalloc(numlower + 1, sizeof(struct ovl_layer), GFP_KERNEL); layers = kcalloc(numlower + 1, sizeof(struct ovl_layer), GFP_KERNEL);
if (!layers) if (!layers)
goto out_err; goto out_err;
...@@ -2042,6 +2045,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2042,6 +2045,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
if (ofs->config.upperdir) { if (ofs->config.upperdir) {
struct super_block *upper_sb; struct super_block *upper_sb;
err = -EINVAL;
if (!ofs->config.workdir) { if (!ofs->config.workdir) {
pr_err("missing 'workdir'\n"); pr_err("missing 'workdir'\n");
goto out_err; goto out_err;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment