summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2017-03-24 07:42:05 -0400
committerCasey Schaufler <casey@schaufler-ca.com>2017-04-04 18:41:15 -0400
commitc3c8dc9f13e2e13013822ee54a529a6fe284f1e1 (patch)
tree77e0bfea1ec966eb0952765574b3b1fa56ecb84e /security
parente4e55b47ed9ae2c05ff062601ff6dacbe9dc4775 (diff)
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: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> fixes: 3bf2789cad9e6573 ("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>
Diffstat (limited to 'security')
-rw-r--r--security/smack/smack_lsm.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 927e60e622d1..658f5d8c7e76 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -695,10 +695,8 @@ static int smack_parse_opts_str(char *options,
695 695
696 opts->mnt_opts_flags = kcalloc(NUM_SMK_MNT_OPTS, sizeof(int), 696 opts->mnt_opts_flags = kcalloc(NUM_SMK_MNT_OPTS, sizeof(int),
697 GFP_KERNEL); 697 GFP_KERNEL);
698 if (!opts->mnt_opts_flags) { 698 if (!opts->mnt_opts_flags)
699 kfree(opts->mnt_opts);
700 goto out_err; 699 goto out_err;
701 }
702 700
703 if (fsdefault) { 701 if (fsdefault) {
704 opts->mnt_opts[num_mnt_opts] = fsdefault; 702 opts->mnt_opts[num_mnt_opts] = fsdefault;