KEYS: request_key() should return -ENOKEY if the constructed key is negative
[sfrench/cifs-2.6.git] / security / keys / request_key.c
index 0d26f689bd7726f7d253607a0f5899c00e947fcc..0088dd8bf68a77b29637527733ff0b8985b8ecb7 100644 (file)
@@ -537,6 +537,8 @@ int wait_for_key_construction(struct key *key, bool intr)
                          intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
        if (ret < 0)
                return ret;
+       if (test_bit(KEY_FLAG_NEGATIVE, &key->flags))
+               return -ENOKEY;
        return key_validate(key);
 }
 EXPORT_SYMBOL(wait_for_key_construction);