Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp239853ybi; Wed, 29 May 2019 20:26:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxrn7FcgyQK458XSYBfAkgkvNcX2qOCfRuRRatzNS2zHl6ZWRPTizCuRy2UOpecxPYHxCsH X-Received: by 2002:a17:902:122:: with SMTP id 31mr1615530plb.217.1559186769545; Wed, 29 May 2019 20:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186769; cv=none; d=google.com; s=arc-20160816; b=048GOFqTWpqii/zI7Kz/1YRXZxSVPQ8Qk6IsOM2M6SW8pyf13GzXrbnJGdf4yOXoXB 0lhrLD4jDbWnLYDB8vAfYJ/2pZVCP+mAdgu2MMihMOkuRScUpg4QTk+NxXwHkl/BSzky ceLZGMRXkKCvHr86h1c+GTVHTz769oDUyRRu8Cm6xM7qrG+vdrG8U1JjJxV4dOj9JaL/ ekjVoTAu/k4Y8h6W1geuEgAWMD0gWuowigyoYMRQ3iJIEwhNJI+4KbPA4XCgQcpYmarR vC+8jPE+e4+cZ/Mt/EkiMQ0em4nBCjF4NkfLv0InOdXwCyYHHJWajKJYh5SHHOlbdaQR vhQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ss68U4orF95zE9jG3g99kd7JKM9eYQRNnVgZugpOoXs=; b=v+X4lIp+s3JJKyatb/5o9QkH9r1f73fbIa3yZ1+kyPjc3w+nZEqVL8N19kubQLL3Ak DnMT9Eyk7Q1Nw172xtfGc0VkDCJxfrFLVVIPA9e6OKDuaPBwZH5DAEOno3vZExioU2rp bZ9nD9/9zBQpWc+MNaS2b6wVlQCm90R/0bX3iwIEqPFoVa8MaLl7n3VEsitScJkZm9G7 F/SZ/7aD35Wfl7gMeL/0+ixtDThyRYjTgbT9+cbAQYsjvhWGl4UjAkTzErCmWbV9jP4h hcCF4V6UxZlhYNyqj1dc0E4NX4rOPMv7kH/Q74j84Ewulagw8gy2LMYlmpkXesOCiz5m +lHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EDKq5owO; 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 s24si1839356pga.515.2019.05.29.20.25.53; Wed, 29 May 2019 20:26:09 -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; dkim=pass header.i=@kernel.org header.s=default header.b=EDKq5owO; 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 S1733168AbfE3DXv (ORCPT + 99 others); Wed, 29 May 2019 23:23:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:48210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731212AbfE3DRl (ORCPT ); Wed, 29 May 2019 23:17:41 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (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 EA5D224703; Thu, 30 May 2019 03:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186261; bh=CORdcStFkjX1oyFVU9FuSam+RRAFqpTQpB8ocBBwANI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDKq5owO6rBPNErEG+ZhhdRS1ed1eSvrgBbAVgqJnjopFFBS4+bpraD46GNqBUda3 vK054az5s/MbCkwiLkOx4a6OTyP4Isu42BQhSd9GmkQfmvAZIAtdwxEkG93waRiPAH LXyGpye0hTDR/gzDWLduC1ndOFB8NX48nmbaqpwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kangjie Lu , Arend van Spriel , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 193/276] brcmfmac: fix missing checks for kmemdup Date: Wed, 29 May 2019 20:05:51 -0700 Message-Id: <20190530030537.215775382@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 46953f97224d56a12ccbe9c6acaa84ca0dab2780 ] In case kmemdup fails, the fix sets conn_info->req_ie_len and conn_info->resp_ie_len to zero to avoid buffer overflows. Signed-off-by: Kangjie Lu Acked-by: Arend van Spriel Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index fa1a2e5ab03fb..c7c520f327f2b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -5368,6 +5368,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, conn_info->req_ie = kmemdup(cfg->extra_buf, conn_info->req_ie_len, GFP_KERNEL); + if (!conn_info->req_ie) + conn_info->req_ie_len = 0; } else { conn_info->req_ie_len = 0; conn_info->req_ie = NULL; @@ -5384,6 +5386,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, conn_info->resp_ie = kmemdup(cfg->extra_buf, conn_info->resp_ie_len, GFP_KERNEL); + if (!conn_info->resp_ie) + conn_info->resp_ie_len = 0; } else { conn_info->resp_ie_len = 0; conn_info->resp_ie = NULL; -- 2.20.1