Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Roberto Sassu and committed by
Mimi Zohar
f91c2c5c 4d67431f

+5 -3
+5 -3
security/keys/encrypted.c
··· 378 378 } else 379 379 goto out; 380 380 381 - if (IS_ERR(mkey)) 381 + if (IS_ERR(mkey)) { 382 382 pr_info("encrypted_key: key %s not found", 383 383 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); 386 388 out: 387 389 return mkey; 388 390 }