Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1225509pxx; Tue, 27 Oct 2020 11:10:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsGQtypKSJFGvCsC/McR9ckuIpxqFUUjtSB9HuCrxK9lTgWyY8N9f5eCXLm2X2L46IRhIj X-Received: by 2002:a17:906:72cd:: with SMTP id m13mr3793907ejl.387.1603822226383; Tue, 27 Oct 2020 11:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603822226; cv=none; d=google.com; s=arc-20160816; b=XX6I6fo5ZlULqVyxX4OEu0OlDTS1crg/AZAMwHNTZj2AYeNp73QSBpTwWLa1QIKiCz Wy0GtLqY5qy0+q7/YHdD1/LFJw9qDtiQkFvbpXN33sNexQ+odbsFdb06caxdnoptwfLn iU+ssST8X8DlFuTcf7863irwt2hEDNNEVUpxcNNQSUV98OZggWqZvc6A8mbs2+nGGM/N 7M6qXuB+IkB9L/S2DSRs8wLhDmgbg6IisDBigQTYnVt+vnKqThfoMQB5UHCxLQHLSzTS sd2t6cAj9iU85bBx3u8rnkn/gMHGa16Ed1OfIsJFYUaB8j0tnooh1qf3/o0K8sRlAP+7 FjJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mLowwkLsN62yOmEW/f66JTu2JzJSA8BFDtyiR82I8Fw=; b=B8Z0vJLgJrNVlDv+ToeTvXfPJkVKu6uFFeXLq5OykzZ3Gjc6m2YWBABs9az0DfPx7J 7b3b/sY7WwepqauIXiLOdUZlGNhkQkEng3KRynsmlqwys3GX0cT/SuZKND065rsEv7r1 db90nP3f3a5YfI4Bc04SE50OXXoN+UeeZPWwrQG2GS1+apCbKv6zsrVaU7REMJdUFOGr vADNuHvbZpCMZSc1EvGgLwu9Q54Lu030UYwMQpWTx2sd5amaW4u+aHIY7v7NqYQYYm2u grP4JN2mh7odFkLUuWP1en5tufOxEMA1xGyqY4kqsH29fxy5tNzWW+v5xV0PSRb6fuZC /COA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AWCyw6Tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 89si1352412edy.301.2020.10.27.11.10.03; Tue, 27 Oct 2020 11:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AWCyw6Tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2902263AbgJ0Obv (ORCPT + 99 others); Tue, 27 Oct 2020 10:31:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:56892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759802AbgJ0OaY (ORCPT ); Tue, 27 Oct 2020 10:30:24 -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 39BB020780; Tue, 27 Oct 2020 14:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809023; bh=OCv81NvY7ue8nkSZVxaFaZV+u+TsXEEr0bXBFJEMj/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AWCyw6Tutv7FNILAd46TiokcJd6H+ZHIGUfQv557QTlZgw4Tw19qdfgURXDsxmoq0 A1uKBH6OrUdP02Ty7Hd3y4hcGaDisgFSEMNsyfqXGeUEks1EuNKRifnLZjwTXlOLZO +qONfubxxDc6D066DCCEhSnVy/MTmwXq/zZUhxH0= 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.4 046/408] cifs: Return the error from crypt_message when enc/dec key not found. Date: Tue, 27 Oct 2020 14:49:44 +0100 Message-Id: <20201027135457.194588363@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -3707,7 +3707,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);