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:06:11 +0000 (17:06 +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 c1fe12cc2ff1d2abb191103c3382c4917f4b75a3..0d5f5640e0e6ebaf933015de6569843aa2377b31 100644 (file)
@@ -692,12 +692,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;