From patchwork Tue Oct 27 13:45:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 289748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 724EFC8300E for ; Tue, 27 Oct 2020 15:27:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 415142242F for ; Tue, 27 Oct 2020 15:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812427; bh=UXWVw92xD2IiNl8i0Lbk5m04/x79jJuEpl26RVJC2EI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=00B9NmakCjhN0kMcbzCTpgjbvUio0qunvkpTteS0oz4559gW3ACuU1Z9OhxT0kkfN cKnYbrFeXzJc9epFVQyhNhafAbQ5Pvmh2rGnZUQhhdcJQxspoNR44CU+jGf6AEIQuX tfCJaC6c/vXbUmZ2B3pq0VVsSjKB68HwuYMxpsgI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1796903AbgJ0PUd (ORCPT ); Tue, 27 Oct 2020 11:20:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1796897AbgJ0PU3 (ORCPT ); Tue, 27 Oct 2020 11:20:29 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6A2420657; Tue, 27 Oct 2020 15:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812029; bh=UXWVw92xD2IiNl8i0Lbk5m04/x79jJuEpl26RVJC2EI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SeFkCwJCjBXr+rgB001h43gFC9BPaIw/s97vP3+Xzd8/2f7t5sPuUkTgNHLk/w7O7 ildvHOWWe+uiXPjdvmHadveVq5R7yO6tDMJoY8jf3N6Ef82UMZZc9MGsh/OeCZsl5w SHA1BE0fOD2GUgmbuuCcFNtu/MQ8TmmRyp11E4Lc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shyam Prasad N , Pavel Shilovsky , Ronnie Sahlberg , Steve French Subject: [PATCH 5.9 067/757] cifs: Return the error from crypt_message when enc/dec key not found. Date: Tue, 27 Oct 2020 14:45:17 +0100 Message-Id: <20201027135453.691570702@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Shyam Prasad N commit 0bd294b55a5de442370c29fa53bab17aef3ff318 upstream. 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 Reviewed-by: Pavel Shilovsky Reviewed-by: Ronnie Sahlberg CC: Stable Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3924,7 +3924,7 @@ crypt_message(struct TCP_Server_Info *se 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);