aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaterina Esina <[email protected]>2023-11-13 19:42:41 +0300
committerSteve French <[email protected]>2023-11-13 16:22:30 -0600
commit181724fc72486dec2bec8803459be05b5162aaa8 (patch)
treeaa26816dfd94149702a1cfe758bc0200be38d79f
parentff31ba19d732efb9aca3633935d71085e68d5076 (diff)
cifs: fix check of rc in function generate_smb3signingkey
Remove extra check after condition, add check after generating key for encryption. The check is needed to return non zero rc before rewriting it with generating key for decryption. Found by Linux Verification Center (linuxtesting.org) with SVACE. Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Fixes: d70e9fa55884 ("cifs: try opening channels after mounting") Signed-off-by: Ekaterina Esina <[email protected]> Co-developed-by: Anastasia Belova <[email protected]> Signed-off-by: Anastasia Belova <[email protected]> Signed-off-by: Steve French <[email protected]>
-rw-r--r--fs/smb/client/smb2transport.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index 84ea67301303..5a3ca62d2f07 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -458,6 +458,8 @@ generate_smb3signingkey(struct cifs_ses *ses,
ptriplet->encryption.context,
ses->smb3encryptionkey,
SMB3_ENC_DEC_KEY_SIZE);
+ if (rc)
+ return rc;
rc = generate_key(ses, ptriplet->decryption.label,
ptriplet->decryption.context,
ses->smb3decryptionkey,
@@ -466,9 +468,6 @@ generate_smb3signingkey(struct cifs_ses *ses,
return rc;
}
- if (rc)
- return rc;
-
#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__);
/*