encrypted_keys: avoid dumping the master key if the request fails
authorRoberto Sassu <roberto.sassu@polito.it>
Mon, 27 Jun 2011 11:45:39 +0000 (13:45 +0200)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Mon, 27 Jun 2011 13:08:39 +0000 (09:08 -0400)
Do not dump the master key if an error is encountered during the request.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Acked-by: Gianluca Ramunno <ramunno@polito.it>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
security/keys/encrypted.c

index b1cba5bf0a5e3d092b57318a242014e915af04ff..37cd913f18ae11b57ec27ad3933c631069d5390a 100644 (file)
@@ -378,11 +378,13 @@ static struct key *request_master_key(struct encrypted_key_payload *epayload,
        } else
                goto out;
 
-       if (IS_ERR(mkey))
+       if (IS_ERR(mkey)) {
                pr_info("encrypted_key: key %s not found",
                        epayload->master_desc);
-       if (mkey)
-               dump_master_key(*master_key, *master_keylen);
+               goto out;
+       }
+
+       dump_master_key(*master_key, *master_keylen);
 out:
        return mkey;
 }