Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp50075imu; Thu, 8 Nov 2018 14:34:56 -0800 (PST) X-Google-Smtp-Source: AJdET5cBMvm9a13bbCaZ2ywuCdV8ztJgpEb+7NYN7vjfDOhBRwxjyfRqrBF2t9nR2uZ+Dp/OJqL6 X-Received: by 2002:a17:902:128c:: with SMTP id g12-v6mr2487413pla.143.1541716496501; Thu, 08 Nov 2018 14:34:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541716496; cv=none; d=google.com; s=arc-20160816; b=lKpVS4GYtUi68e4RPEJtBCnuoXZaPWPswygCIaw/cCggvFX4vG/ZcvsXEgdhG1SwOV 76VF/5/wmUgCBxw4BIIB8q1Xakpxq3Cg4qV6IpGvwVZni+USliqvFx8ggZf+BCDk5qjt jSeSVNd+UH4pcJ6iYumRuQrzdJB26zmJmMCDb0hzngNUrRdhhYc51wzI9lqNpkMTV1vB GETx4YKPr9U4dEbX33ItNQFv21oWKu3REImy1mxiwv9bkMt7CTjARf0z0BwUca8K/i3l ccdwgw7i0co1VFR8gZ8va2TAxpHNn56TdVu5nY7kZ1m7MKQsCCWZ24ibDri8pJsRiLJ+ EpOg== 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=Pn469rkIAmCSld7T21Klk7Qku47Qu+DSGyRZbUgWUHo=; b=BEKNmF0xndyMwY8VEigWm/mGG+4hJJJZA4vNE1HVV+gsYOYFi62PPmBLQI3SurU3lN C+OaXd12s4Shipl/fPqZEQPHlUOd8Cu0C68Z0O4w7YTTSCoAlTcAA+ETArqMmaD2SlH8 UfEBWTj/VxDYXNE76U/3NDSe1pMfqibERJlIL2/GQbK/8MyMgdcpCTfm00XAW6fINgHQ u9FsQ9iaznmcL5x11lQCpbO4xh0BtPW6P8MOGFLbczFMaDP+fBw6W9634M8Tx3VHiw7y eWKcaEoSscQ3qp/PCJ5XxbqZ/2K8MK1L3gZPtdY+ZWmuUHnHU8EMJlgJRwBkNhxRfk/k SM5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v+C6VU9y; 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 l4-v6si5978593plb.258.2018.11.08.14.34.41; Thu, 08 Nov 2018 14:34:56 -0800 (PST) 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=v+C6VU9y; 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 S1729635AbeKIIKk (ORCPT + 99 others); Fri, 9 Nov 2018 03:10:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:55750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730282AbeKIHh3 (ORCPT ); Fri, 9 Nov 2018 02:37:29 -0500 Received: from localhost (unknown [208.72.13.198]) (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 2B36F21479; Thu, 8 Nov 2018 22:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541714401; bh=4RgqZNm+Eje2qleYdiDI4V/CEzmxU4jd04Uq7e1WigM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v+C6VU9yXYqEfMZ4UDuSB+p5DKWLts6i1tImDfBizxxJeB0w09YTtoeldnyoUnAc9 K6znMO7XJv0RpacIK4w9g+F4/Kr57cqviRjg7gycnlDRYI/Aia27TdDP2pYdYkDVAH R6O2n7V3JZ/4cnIEDNxlUXS8k8w5TJy5FXcF1pZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter S. Housel" , Arend van Spriel , Kalle Valo , Sasha Levin Subject: [PATCH 4.4 062/114] brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain Date: Thu, 8 Nov 2018 13:51:17 -0800 Message-Id: <20181108215106.708059832@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181108215059.051093652@linuxfoundation.org> References: <20181108215059.051093652@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 5ea59db8a375216e6c915c5586f556766673b5a7 ] An earlier change to this function (3bdae810721b) fixed a leak in the case of an unsuccessful call to brcmf_sdiod_buffrw(). However, the glom_skb buffer, used for emulating a scattering read, is never used or referenced after its contents are copied into the destination buffers, and therefore always needs to be freed by the end of the function. Fixes: 3bdae810721b ("brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain") Fixes: a413e39a38573 ("brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support") Cc: stable@vger.kernel.org # 4.9.x- Signed-off-by: Peter S. Housel Signed-off-by: Arend van Spriel Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c index 91da67657f81..72e1796c8167 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c @@ -705,7 +705,7 @@ done: int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, struct sk_buff_head *pktq, uint totlen) { - struct sk_buff *glom_skb; + struct sk_buff *glom_skb = NULL; struct sk_buff *skb; u32 addr = sdiodev->sbwad; int err = 0; @@ -726,10 +726,8 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, return -ENOMEM; err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr, glom_skb); - if (err) { - brcmu_pkt_buf_free_skb(glom_skb); + if (err) goto done; - } skb_queue_walk(pktq, skb) { memcpy(skb->data, glom_skb->data, skb->len); @@ -740,6 +738,7 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev, pktq); done: + brcmu_pkt_buf_free_skb(glom_skb); return err; } -- 2.17.1