Commit c3c8dc9f authored by Tetsuo Handa's avatar Tetsuo Handa Committed by Casey Schaufler

smack: fix double free in smack_parse_opts_str()

smack_parse_opts_str() calls kfree(opts->mnt_opts) when kcalloc() for
opts->mnt_opts_flags failed. But it should not have called it because
security_free_mnt_opts() will call kfree(opts->mnt_opts).
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
fixes: 3bf2789c ("smack: allow mount opts setting over filesystems with binary mount data")
Cc: Vivek Trivedi <t.vivek@samsung.com>
Cc: Amit Sahrawat <a.sahrawat@samsung.com>
Cc: Casey Schaufler <casey@schaufler-ca.com>
parent e4e55b47
...@@ -695,10 +695,8 @@ static int smack_parse_opts_str(char *options, ...@@ -695,10 +695,8 @@ static int smack_parse_opts_str(char *options,
opts->mnt_opts_flags = kcalloc(NUM_SMK_MNT_OPTS, sizeof(int), opts->mnt_opts_flags = kcalloc(NUM_SMK_MNT_OPTS, sizeof(int),
GFP_KERNEL); GFP_KERNEL);
if (!opts->mnt_opts_flags) { if (!opts->mnt_opts_flags)
kfree(opts->mnt_opts);
goto out_err; goto out_err;
}
if (fsdefault) { if (fsdefault) {
opts->mnt_opts[num_mnt_opts] = fsdefault; opts->mnt_opts[num_mnt_opts] = fsdefault;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment