SELinux: Use GFP_KERNEL for selinux_parse_opts_str().
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Mon, 14 Nov 2016 11:16:12 +0000 (20:16 +0900)
committerPaul Moore <paul@paul-moore.com>
Mon, 14 Nov 2016 20:03:38 +0000 (15:03 -0500)
Since selinux_parse_opts_str() is calling match_strdup() which uses
GFP_KERNEL, it is safe to use GFP_KERNEL from kcalloc() which is
called by selinux_parse_opts_str().

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c

index 09fd6108e42134871953f2cb46f9410808c1f702..d1b141e33ecb59876a58542f12524c050999f4ea 100644 (file)
@@ -1100,11 +1100,12 @@ static int selinux_parse_opts_str(char *options,
        }
 
        rc = -ENOMEM;
-       opts->mnt_opts = kcalloc(NUM_SEL_MNT_OPTS, sizeof(char *), GFP_ATOMIC);
+       opts->mnt_opts = kcalloc(NUM_SEL_MNT_OPTS, sizeof(char *), GFP_KERNEL);
        if (!opts->mnt_opts)
                goto out_err;
 
-       opts->mnt_opts_flags = kcalloc(NUM_SEL_MNT_OPTS, sizeof(int), GFP_ATOMIC);
+       opts->mnt_opts_flags = kcalloc(NUM_SEL_MNT_OPTS, sizeof(int),
+                                      GFP_KERNEL);
        if (!opts->mnt_opts_flags) {
                kfree(opts->mnt_opts);
                goto out_err;