The 'rc' will be re-assigned to 0 after calling get_vcssb(), it needs be set to error code if create_cs_keyring() fails. Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- arch/s390/kernel/cert_store.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c index 1cbeb9ce0eb1..38ad11c2be12 100644 --- a/arch/s390/kernel/cert_store.c +++ b/arch/s390/kernel/cert_store.c @@ -703,8 +703,10 @@ static int fill_cs_keyring(void) goto cleanup_keys; cs_keyring = create_cs_keyring(); - if (!cs_keyring) + if (!cs_keyring) { + rc = -ENOMEM; goto cleanup_keys; + } rc = add_certificates_to_keyring(vcssb, cs_keyring); if (rc) -- 2.25.1