summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--security/keys/keyctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index cd5bd0c..8a8c233 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -37,8 +37,6 @@ static int key_get_type_from_user(char *type,
return ret;
if (ret == 0 || ret >= len)
return -EINVAL;
- if (type[0] == '.')
- return -EPERM;
type[len - 1] = '\0';
return 0;
}
@@ -86,6 +84,10 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type,
if (!*description) {
kfree(description);
description = NULL;
+ } else if ((description[0] == '.') &&
+ (strncmp(type, "keyring", 7) == 0)) {
+ ret = -EPERM;
+ goto error2;
}
}
OpenPOWER on IntegriCloud