Skip to content

Commit f91c2c5

Browse files
Roberto SassuMimi Zohar
authored andcommitted
encrypted_keys: avoid dumping the master key if the request fails
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>
1 parent 4d67431 commit f91c2c5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎security/keys/encrypted.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,13 @@ static struct key *request_master_key(struct encrypted_key_payload *epayload,
378378
} else
379379
goto out;
380380

381-
if (IS_ERR(mkey))
381+
if (IS_ERR(mkey)) {
382382
pr_info("encrypted_key: key %s not found",
383383
epayload->master_desc);
384-
if (mkey)
385-
dump_master_key(*master_key, *master_keylen);
384+
goto out;
385+
}
386+
387+
dump_master_key(*master_key, *master_keylen);
386388
out:
387389
return mkey;
388390
}

0 commit comments

Comments
 (0)