KEYS: fix parsing invalid pkey info string
[sfrench/cifs-2.6.git] / security / keys / keyctl_pkey.c
index 70e65a2ff2073a5d65cd20fb07b5accce4684955..8bdea5abad1185cabe9f35258870afad6a3669f8 100644 (file)
@@ -50,6 +50,8 @@ static int keyctl_pkey_params_parse(struct kernel_pkey_params *params)
                if (*p == '\0' || *p == ' ' || *p == '\t')
                        continue;
                token = match_token(p, param_keys, args);
+               if (token == Opt_err)
+                       return -EINVAL;
                if (__test_and_set_bit(token, &token_mask))
                        return -EINVAL;
                q = args[0].from;