Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1952279ybv; Fri, 14 Feb 2020 08:47:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwHUMdy4ctERWtCf5fyiOiwQ/YJgV2YaasqdlPqr+hQbiCFTuSSulNOGOkc5Taf6uAhDMxv X-Received: by 2002:a05:6808:8e1:: with SMTP id d1mr2479764oic.68.1581698824046; Fri, 14 Feb 2020 08:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698824; cv=none; d=google.com; s=arc-20160816; b=EYYjgyQfI5+2j+cUVdhzUZ7u1eBLaDex0B8w7cpsB2mDoYRU4h1U4uKSSIqfS7AfLA sYF8+o03cGU57dmLTf0PSH+ktpaL6Db2qqoadI09BYTZpYPhJq9OllV91n8ex6h0HMnV gQCgE/9a7Qq57kHuUmTnhyKgyFwPiv7w1wKBcgJtUVL0C1X4RCqdPAE7Av+2QAdan//C lpIt9NE+h4w/qUKWIM2a3/F6e5qvUrKzgiTubNyXxjJpA/1G6c5+fNNr2vNIxseV3lT9 1gQVj5UkvgNEcjh7KF5y888D+XYvYJT2GDQZIU/WLQ/ZRqD2kkaSyMtIivEwV3Ey4/Nr VgqA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cyar6NskahenoxnoYEdS/E6gCZC9FNv5hUgJR6+LPio=; b=tj6e6JkVrmMobvs30tFRSMwQ78APFBoW5ozH6GhUUbtubgAw05Y4QoxUw3ybnWc7Vd 9Sn2wuS4zpnJvLa0BZAAWGORIuVgybvkOjPIafWoTdQCr52YqRonWpJbFj0iBUFo9Gnd TORZJAqvC/U9xCG7NIMjLU7K9bx9bT5Kgko+xqD+FFRzhRXIkSUy++drmO7zPwISnRHf W/+AoZXVNHSQkCM1MeOR2VBOFvLvjFSGl3MfyVFH3TxRZT+i0Ex9qofcpBwh0mXeDQjD d61/iBr07sMEUDWaqS/H1Anv3sHz5Gib3V26nnstzY+UQc229U+oyU9aIR/GF4GakAsA wp7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CnKneg26; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7si3404348oti.301.2020.02.14.08.46.52; Fri, 14 Feb 2020 08:47:04 -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=CnKneg26; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394121AbgBNQqJ (ORCPT + 99 others); Fri, 14 Feb 2020 11:46:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:56156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392966AbgBNQVb (ORCPT ); Fri, 14 Feb 2020 11:21:31 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 37118246A6; Fri, 14 Feb 2020 16:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697290; bh=djrylqynmlxVfb1NigsjuAumrzZme2zHlypxM5eLteM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnKneg26fiNd4auWY0d39/PVdlc4SrkyKZGIb8jcmCDquB6oLBm0fVOFTqYlGBFz6 lkiimNJz059n3WiFCrnrHfin50cDuYRjsVNHhc24pm3ZD/tF53tMLjqpoV2PwKMGVM LL8SL6bOzSQ7E9S0arCwWT7LLEGs0znISpclwW8s= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dan Carpenter , Franky Lin , Kalle Valo , Sasha Levin , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 006/141] brcmfmac: Fix use after free in brcmf_sdio_readframes() Date: Fri, 14 Feb 2020 11:19:06 -0500 Message-Id: <20200214162122.19794-6-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 216b44000ada87a63891a8214c347e05a4aea8fe ] The brcmu_pkt_buf_free_skb() function frees "pkt" so it leads to a static checker warning: drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:1974 brcmf_sdio_readframes() error: dereferencing freed memory 'pkt' It looks like there was supposed to be a continue after we free "pkt". Fixes: 4754fceeb9a6 ("brcmfmac: streamline SDIO read frame routine") Signed-off-by: Dan Carpenter Acked-by: Franky Lin Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c index de52d826eb248..998a4bd6db78a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -1921,6 +1921,7 @@ static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) BRCMF_SDIO_FT_NORMAL)) { rd->len = 0; brcmu_pkt_buf_free_skb(pkt); + continue; } bus->sdcnt.rx_readahead_cnt++; if (rd->len != roundup(rd_new.len, 16)) { -- 2.20.1