Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4632654pxj; Wed, 12 May 2021 09:39:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyexo2RiHuSXVDtfT7cZ8i0/Q2Gh9dDuQK/IsRSD+8zkRpogRLJuA69nt9s0oO9exeQzf9F X-Received: by 2002:a05:6512:70a:: with SMTP id b10mr26702893lfs.44.1620837597517; Wed, 12 May 2021 09:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837597; cv=none; d=google.com; s=arc-20160816; b=V+eS0/Ve4Zx9taSyy0exbM6D6giq/NUQFZntJ16kNchGbeg2FUtnL8vuY/CEWMqQB3 rmWhyOch08NEF1EYMvg2e0WwETRkHxkMy/fha03AUmUB5GOJVl0gupu5ljnW7Ovzhj2T bpHZEJLLNbP0Qplcd3oaUFPxldrdGQnloBDhcDDgN0BbtCqibEU6nqOG1z6FeW2NlfIa 8lCSwShxTmTyBp04Yd37zscf1Y7o61TOYXv5L0hUC1OkSQc5xKCpwg4HFpvTF8CumE8T ySqBIUO9fTNrj/oO1csu2jmD+xB3jIGmZ9k/Rgkq2Oo6ULH4DxSMJ9epRST6Whp1C1+V Nx0w== 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=PUUdbXO8vknKU7d3TYNKWZPLawp4Os/0ybeOcSm1FF8=; b=tHOffTNbk+hBdimbLHRM+7xyyotj40ANX47CYkOwctOMw+sQw4pEww3naaxAJzCLKf ysrclp5wGjwuQQHq60sWgG++Xg8D0Z0fNIBoyDtq1AF49PqmwtLFRgk7Ke/nT3XjPFQm HuvEYOqJM0V51nJ1nhk26/Tpi0nZYPDXuvneM4I+FMVJSqv7cYnoFaPvLPQ0eT+H+oPt 9ieL2VcngqOBgF7WBEsAGujN+/g3oVsxmX6B6lOuuZjeJuL8gGJNmqG04Xj9Yx7+UTnd hDRMveRf8Fvlr6tK3O7BHQcRKs/kzZDqKD9WKYbYnCDgWKlUZ5hIGsnfWaPHHR3HhrYr HLKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b3a07fRd; 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 u26si266560lji.483.2021.05.12.09.39.24; Wed, 12 May 2021 09:39:57 -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=b3a07fRd; 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 S234197AbhELQcC (ORCPT + 99 others); Wed, 12 May 2021 12:32:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:57182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234477AbhELPlE (ORCPT ); Wed, 12 May 2021 11:41:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6DC936134F; Wed, 12 May 2021 15:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832884; bh=rEMQQABg0v7poNKGwYlbP5p6/nRugTlf3CwwFtexDUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3a07fRdiyi9f9+Y+fDEYCl6oDbHg2wHGN0hQOMqau0lWIyQNfuezKS+Ji3JSI+T6 BybCJ8zrfxi4v+oxDPQlIY7ew+1qdm7sdmIthyGFeUuk77sNUccSiWbtJLHZvFdZ/+ RqzlL0oh2ptXiGcsWsw269psiJu9SOnVX4aWB/Dw= 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 5.10 462/530] mwl8k: Fix a double Free in mwl8k_probe_hw Date: Wed, 12 May 2021 16:49:32 +0200 Message-Id: <20210512144834.942114251@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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/marvell/mwl8k.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c index 23efd7075df6..27b7d4b779e0 100644 --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c @@ -1469,6 +1469,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