BACKPORT: Smack: Use GFP_KERNEL for smack_parse_opts_str().
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Mon, 14 Nov 2016 11:12:55 +0000 (20:12 +0900)
committerRafal Krypa <r.krypa@samsung.com>
Mon, 21 Nov 2016 16:09:16 +0000 (17:09 +0100)
Since smack_parse_opts_str() is calling match_strdup() which uses
GFP_KERNEL, it is safe to use GFP_KERNEL from kcalloc() which is
called by smack_parse_opts_str().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
(cherry-picked from upstream 8c15d66e429afd099b66f05393527c23f85ca41c)

security/smack/smack_lsm.c

index 71a3cb097457a4a76da36dd82714c76f4964b3e7..0c910096b59f264f983940fc8023b7287f937fff 100644 (file)
@@ -694,12 +694,12 @@ static int smack_parse_opts_str(char *options,
                }
        }
 
-       opts->mnt_opts = kcalloc(NUM_SMK_MNT_OPTS, sizeof(char *), GFP_ATOMIC);
+       opts->mnt_opts = kcalloc(NUM_SMK_MNT_OPTS, sizeof(char *), GFP_KERNEL);
        if (!opts->mnt_opts)
                goto out_err;
 
        opts->mnt_opts_flags = kcalloc(NUM_SMK_MNT_OPTS, sizeof(int),
-                       GFP_ATOMIC);
+                       GFP_KERNEL);
        if (!opts->mnt_opts_flags) {
                kfree(opts->mnt_opts);
                goto out_err;