Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1825090imm; Mon, 3 Sep 2018 10:24:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYRaRqp1A4jNZyAruAiOpLvooo1HJLaDoxMaF4PabxZHIlBjQa+HEmjxOLvzEPzYYtQWQmb X-Received: by 2002:a17:902:7c0a:: with SMTP id x10-v6mr29440287pll.77.1535995457788; Mon, 03 Sep 2018 10:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995457; cv=none; d=google.com; s=arc-20160816; b=BmjEKhY9ZHOLMxSCwPcxf1p8BmhSRl6DUWGF6QJuds2mkabqLjqSPvxZhOTQ0knFYo Vw373tBCsp7ACxKua7AUhIYej4OaNzEJafU3idvBxNRmg27kNjOsjYkcua4DS32ko4+U 34fzdgKalq9DGc/hIP0oLPrM4leWZwpuE5owKyyhPNOEXKOa6+eRzcV7dgdMWnrY9ita 2DxaPXrm8sg3dshyldLbGPfOb2cSTkJHq18B3QlON24DkWp/fIEl9hpMbaG3h6TKpx+L uSPjIPRobTHFBQUuqxIxK8WGAANwF6kq+MJcFcqUXNr3vuhTTwq/ipyH+BaGblizniYS qnbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ya6tnVmhF99K46yYr/BHhgPFE9/eHna3hO5Ke0aoQyQ=; b=dNzsp7DaqdOYPcmV6To/B59XW/2iAxWKNKAIIzJqw8OAoeE+ahtsiatyQ3+nFqVqf0 jNbKh78f1kVCGH/nKeb2PROI4nWGvLGEPxfI7UAKU6X1saxt65F9jBthlRcW34DYD/KA Dnug1PR6wYCM9nGu25F40vFm2QzqglHACZ6nOiNUVKzWhG+MJaEGGsKjMmdhdIulcSBe mQ1w3urtHcV3lHWsObbbERfzRHxlzI53jTqBFEBW/aAoOHe4OrgM3+jPN1asXBATQSNB nZv4dy/GsARVo/nFijb3U+YH3CKnOWejZzxD+gjpAEbObbCKMz+aA1z89toR/K0a/T58 /VQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4-v6si20964630pfc.219.2018.09.03.10.24.03; Mon, 03 Sep 2018 10:24:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730320AbeICVnf (ORCPT + 99 others); Mon, 3 Sep 2018 17:43:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45304 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728636AbeICVne (ORCPT ); Mon, 3 Sep 2018 17:43:34 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 93191D00; Mon, 3 Sep 2018 17:22:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Mc Guire , Steve French , Pavel Shilovsky Subject: [PATCH 4.14 085/165] cifs: check kmalloc before use Date: Mon, 3 Sep 2018 18:56:11 +0200 Message-Id: <20180903165659.379463886@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Mc Guire commit 126c97f4d0d1b5b956e8b0740c81a2b2a2ae548c upstream. The kmalloc was not being checked - if it fails issue a warning and return -ENOMEM to the caller. Signed-off-by: Nicholas Mc Guire Fixes: b8da344b74c8 ("cifs: dynamic allocation of ntlmssp blob") Signed-off-by: Steve French Reviewed-by: Pavel Shilovsky cc: Stable ` Signed-off-by: Greg Kroah-Hartman --- fs/cifs/sess.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned cha goto setup_ntlmv2_ret; } *pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL); + if (!*pbuffer) { + rc = -ENOMEM; + cifs_dbg(VFS, "Error %d during NTLMSSP allocation\n", rc); + *buflen = 0; + goto setup_ntlmv2_ret; + } sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer; memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);