Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2119045lkv; Thu, 20 May 2021 03:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzm/uJCMLEGWRCdvhYSNzfHa0Wxvepaik+peqj05bx3aNkV2nA7Vnr3YjbDWLKjdi/jYbC/ X-Received: by 2002:a17:906:924a:: with SMTP id c10mr4025177ejx.415.1621507918285; Thu, 20 May 2021 03:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507918; cv=none; d=google.com; s=arc-20160816; b=Tc1FK9QVcUwJS+LnbVFc58/DZPwZEjOa8ksiKZzy2bQn7mOe/HGPRHEX+QEPW3dUtJ 8F/eTLmUcbmJFjG+vBb1PFQhArMExRxHF1XHHglVZbmw2xso8ilCLHWZS0KHql4eTJ0m EgoJJU/3DPY/AbjQFEHIFVmVIXlkyeHPVv0deTjmBhEol7kYN4rU35weJd4JZ1vxgBe9 nn+VfzDh+huJmyBxrcVDfDTxx9LFHM64NoXlnpoh+bmdhVFYPxl60HO5cvhn0eJJVD7s Q8tmQCSzewutnyX/ckIzMuD5MgE0kAtKqa8ikJ6dy4zQsyIUpVUy4HNfVC5y4fO38JLH zveQ== 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=RSGPhsr/qg2XYhLn06Q5Wb6FTaxDvmU3j9W+OjHgJn8=; b=ngDT9ScsgicunuVxEeybuu4kVNEc33jF/uJwzSzES5ewxefL8X18ko0/GjdNGMrNY4 VRs7sU2/2M5ZzlSnbOvWJHS3BsKmDAYkLUCz4z71doQK3668ZICw5Ga8ldliEqFkCIce vbnR9NqnIM1tDQ2SiLUBB0jWXmRet6ArLIv7uHZTFmBkb18e/EQWItk1sDhkpQubyYXj FGXqxDBNzD0NmwPXmaMLLFXjW3XhlkD92XNbv53Wqro5TwVxTYyF4g47bxCXGwp4vHf7 sIEIw5llcTYItR1aWwzfMdka4sidJ8lRKALm8fMObfaVHH1dvZ3c+KaCr8LZ254CXwpd 7G3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S0bH2S8r; 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 ks25si2326223ejb.576.2021.05.20.03.50.50; Thu, 20 May 2021 03:51:58 -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=S0bH2S8r; 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 S238489AbhETKtU (ORCPT + 99 others); Thu, 20 May 2021 06:49:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:60460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237305AbhETKdk (ORCPT ); Thu, 20 May 2021 06:33:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F317161C51; Thu, 20 May 2021 09:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504378; bh=buqJqw0bvNnd5ForWdt98KkmOmySANGI6ExAAgNy6w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S0bH2S8rARoH2kuGzrsDFx3ELj/NPa6oekX0E83FlzOtEOvFy0cqa7LGGQEvebj3o 027+cQwaa/qzXitpWE9rp8pQcmJ4yIZ/tuKd1Hm4KPSoXkVm4jjz37Wz/0GP0lj8vi 7nSwEQ+OqewCuHvvQFNV7jUDzWnA1jeOIrJQzBuY= 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.14 219/323] mwl8k: Fix a double Free in mwl8k_probe_hw Date: Thu, 20 May 2021 11:21:51 +0200 Message-Id: <20210520092127.638234673@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 a87ccf9ceb67..e39aaee92add 100644 --- a/drivers/net/wireless/marvell/mwl8k.c +++ b/drivers/net/wireless/marvell/mwl8k.c @@ -1464,6 +1464,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