Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp619848pxj; Thu, 20 May 2021 18:06:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX5GAm1iUSuu9dGH4kjerT8EmWFdj3CZpPmMKL61xJTmaq+4n75eovfag6qtGGeMYvAUam X-Received: by 2002:a50:fb17:: with SMTP id d23mr7655183edq.338.1621559219097; Thu, 20 May 2021 18:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621559219; cv=none; d=google.com; s=arc-20160816; b=jE6MRUH9GVoxNhdNf//Ic1BHXX1F9DBg/tSkp9M2YosccSQ8+rztRwZI95K68H6+5K /1GT5qiuMPihe1LVt1m/+ivGDo+dZqtKqi6qGKCW1DFsjxnGFXLv0nZqoc+M5yh4R+BW h/Md5kmkf1p3hkSHmzJpTCT12bAvnu8pR2MULypuKZrqc9pI5ATvufBfUhPT1Xibbb4A GWrH1RiOVaiKnifIO66hEiCZYyCVYhcHF3/4v9P2pVSrwJYNehtU21ZD8YOUlO56iIbc gqF0Qb2RPBpOBLzhbNeHtM9cswB13elmh4cOkKP/pUnwE6gaEEqlLyzEML+UbvB3kiPB 4+sQ== 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=bmhhr4STOoe+8nhxATz1SCe6cKN7FzUWuNeaO+s1PZA=; b=ZB+aLGTg13jk0TOD2rha3kCW/MSrDSFRkXbxhzQYJxjKiN9tu6qjE3rY6Zm6FRkT4F 5JwtED0+kBG1Gez6dFk9LfRD+1yfJ2jpvsK+qxTHa/WYvsscbzjqA9uqJTVCdJXiPFGl KzJdIQbc7B7PaHHpHM84MyBDLto9vikC2K4YFHZZOnpRbLE7cDfc9XGtRJ/micfH8EIU jDYRgKfhhdIcxe9mC0ygGpByFRi1fhuLMEgFn200RPglk3XGU2VlH+3qUxOPcLHYUQHF KVBAGT1PiZryKAJws1GJFfAxxS9T7xtk2Ir81vcPaIkrGd6YBzuG/Sa5GnggwoUBDbid CRxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gl8abSZV; 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=pass (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 b5si3526697edf.3.2021.05.20.18.06.35; Thu, 20 May 2021 18:06:59 -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=@linuxfoundation.org header.s=korg header.b=Gl8abSZV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242176AbhETLjR (ORCPT + 99 others); Thu, 20 May 2021 07:39:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:37920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240679AbhETLTH (ORCPT ); Thu, 20 May 2021 07:19:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 120FE61D75; Thu, 20 May 2021 10:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505417; bh=zxuLGrBTmBa/HsIIrpnILXloFIxoiESPmeAb8Nk0y74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gl8abSZVyKKcZ8kUbrHkLImax0XBIgNrQNmTtcd437x9BDoxqfOyGE8WbJX0Kvcoc fTduQVG7698e2NcOvFDyFzpPPwxa9hBERNOcDB5HS26cCFb1OXuiRxAU5oUGi95EMw tcmsFwibwMEk9kTwZFIRnBmBMd0iR8GOUrlNXEdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lv Yunlong , Kalle Valo , Sasha Levin Subject: [PATCH 4.4 126/190] mwl8k: Fix a double Free in mwl8k_probe_hw Date: Thu, 20 May 2021 11:23:10 +0200 Message-Id: <20210520092106.371129919@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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: Lv Yunlong [ Upstream commit a8e083ee8e2a6c94c29733835adae8bf5b832748 ] In mwl8k_probe_hw, hw->priv->txq is freed at the first time by dma_free_coherent() in the call chain: if(!priv->ap_fw)->mwl8k_init_txqs(hw)->mwl8k_txq_init(hw, i). Then in err_free_queues of mwl8k_probe_hw, hw->priv->txq is freed at the second time by mwl8k_txq_deinit(hw, i)->dma_free_coherent(). My patch set txq->txd to NULL after the first free to avoid the double free. Fixes: a66098daacee2 ("mwl8k: Marvell TOPDOG wireless driver") Signed-off-by: Lv Yunlong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20210402182627.4256-1-lyl2019@mail.ustc.edu.cn Signed-off-by: Sasha Levin --- drivers/net/wireless/mwl8k.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 088429d0a634..d448480b8406 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c @@ -1459,6 +1459,7 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index) txq->skb = kcalloc(MWL8K_TX_DESCS, sizeof(*txq->skb), GFP_KERNEL); if (txq->skb == NULL) { pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); + txq->txd = NULL; return -ENOMEM; } -- 2.30.2