cifs: Return the error from crypt_message when enc/dec key not found.
authorShyam Prasad N <sprasad@microsoft.com>
Thu, 15 Oct 2020 17:41:31 +0000 (10:41 -0700)
committerSteve French <stfrench@microsoft.com>
Mon, 19 Oct 2020 20:11:39 +0000 (15:11 -0500)
In crypt_message, when smb2_get_enc_key returns error, we need to
return the error back to the caller. If not, we end up processing
the message further, causing a kernel oops due to unwarranted access
of memory.

Call Trace:
smb3_receive_transform+0x120/0x870 [cifs]
cifs_demultiplex_thread+0xb53/0xc20 [cifs]
? cifs_handle_standard+0x190/0x190 [cifs]
kthread+0x116/0x130
? kthread_park+0x80/0x80
ret_from_fork+0x1f/0x30

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2ops.c

index 48657ddbd75e689c20fc05034f2c13ea0870e11e..0dfa832a3de07a33aa132fa87539f04ab66c7db9 100644 (file)
@@ -3944,7 +3944,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst,
        if (rc) {
                cifs_server_dbg(VFS, "%s: Could not get %scryption key\n", __func__,
                         enc ? "en" : "de");
-               return 0;
+               return rc;
        }
 
        rc = smb3_crypto_aead_allocate(server);