Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp347364pxj; Thu, 20 May 2021 10:39:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWa/HxiiAE5mhRe+xXZwLCoNUDJanzKsIrK/xh+yAx36QYwrNq7HtT7jsh6jzL9zsaiMHS X-Received: by 2002:aa7:c684:: with SMTP id n4mr6368899edq.357.1621532392081; Thu, 20 May 2021 10:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621532392; cv=none; d=google.com; s=arc-20160816; b=Yv/+3vZt9B5RfEW63OI1Ic1fhiKbxjHKfb1DuHEbyALo9e7W4U9MJDfTFZ0GAbQ7rf OG5EdI09wCVI1WXv1LPICkRe2ryb0o6qpAT/qIHwoePDVR186L2kSM74F6GuZTs08wsZ T2fm0Et9o4Lvgt9MtF2GQ8KKefI1zr4fnAVJLFggZST1d9ApjOnB1hMkKyZFsQMZokDZ zN178qc0BiDTgOJRa4qbK0Ow45U/iyl2Z3PTraK/9bRk71MMGsie9RH0cksZXUaYjM5Z t5hEPkFcc1R5biNCk5QEm3sEKzUuz0IapSUqeisSceTkcR3l4c7rl3cXjEJrzMLxQefu V45A== 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=GEGjetE4PlC1NJrVb5NDsVgt+Fd2NkkibuL0ZDo2J+U=; b=HlhTKRPGmvv9ndrmki/ZPRRoX7U0wImjt+D1s6PP2KIf8j6lR0TdbybX3ufVCoR7eS 12tQqfCZtZdoHBKDj838sETjQOwvFmbNkG9cyKHnRd4CEWbhVWECeh0uyfEPUSFOdY4R he5HK+04yK5PykuAhIU962vrrDc5IzqibRjLmhrFS0sxquLtStoDDC0l2MhjquED1JjG QV4PVhQqG2lQDLm0Dd9UsTwV5KGefc0kGK8uUqniAnx3mgJc2uZI9A25IsOpOesqpXna VJWTIuoXrEeQMHrDpSckunr4YuhrQ6/E1k/ut1j+x43YFZmuvhfe2hoB4uWuTRcqeqWj 8VuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gjPI21Il; 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 b5si2722021edf.3.2021.05.20.10.39.28; Thu, 20 May 2021 10:39:52 -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=gjPI21Il; 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 S235523AbhETKHL (ORCPT + 99 others); Thu, 20 May 2021 06:07:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:36564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234846AbhETKBP (ORCPT ); Thu, 20 May 2021 06:01:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85D2661879; Thu, 20 May 2021 09:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503562; bh=G2YT7KwnLUDdyTIw8I77QNBFKv1bTaQVTrOq2jP8APE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjPI21IlJt5DHYoOgMu1AKiY8tXHxp5Tvi5FkEh/AAPAIlkTp6yVSv086ZfvBr8vO tQxW682VCreBggKq7W6VGO7ZoNe0o4Cl5rz71kfA3Kj6tVrmEtVM7zFUTcr8u2jgZS 8X8p3vvUuUfn2nsRqSNra9k67ASUtAWlRwbOAqIU= 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.19 277/425] mwl8k: Fix a double Free in mwl8k_probe_hw Date: Thu, 20 May 2021 11:20:46 +0200 Message-Id: <20210520092140.547787203@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 ffc565ac2192..6769b0c5a5cd 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