kmemdup return value is saved in 'key->index_key.description', not
'key->descrption' and kmemdup can be failed in memory pressure.
Therefore, key->index_key.description should be checked.

Signed-off-by: Insu Yun <wuni...@gmail.com>
---
 security/keys/key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/keys/key.c b/security/keys/key.c
index aee2ec5..c047846 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -278,7 +278,7 @@ struct key *key_alloc(struct key_type *type, const char 
*desc,
 
        key->index_key.desc_len = desclen;
        key->index_key.description = kmemdup(desc, desclen + 1, GFP_KERNEL);
-       if (!key->description)
+       if (!key->index_key.description)
                goto no_memory_3;
 
        atomic_set(&key->usage, 1);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe 
linux-security-module" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to