Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3651907pxb; Mon, 24 Jan 2022 14:29:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5kZxIj+E778cpBTt2nCtQNRZ+MtwztICoEZ20aF36XEgImXQ0JYiwJ+3tkw5SJ1n4Xvo+ X-Received: by 2002:a17:902:b116:b0:14a:a4a1:e7a4 with SMTP id q22-20020a170902b11600b0014aa4a1e7a4mr15673261plr.82.1643063344065; Mon, 24 Jan 2022 14:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063344; cv=none; d=google.com; s=arc-20160816; b=sF6q7tGHiRbxgri06r6Dv+uA6MFI3XElAVpeQJu1s8IyMfcT5Ljoz+aFc2IjZVmCaQ lNq9qctwZZSVF87/KOigtxopP856osDHUfN+43fXw3RGl9GiFS94C59LiaPx3Gu0vJyI em7BOdXUPv2s42DDJIPEDF6a+aYY5vGnKwitSzb8PZyosgtLkObkPMjyMb10RhTXYfVG 7Xo++FDF8+W7hZ/Qul/o9g++PRVoHPZSGnRVDUVnsVufLctDRB4FGNDAcF4PWVvIyQVn vDqZ0UlslITse+ShGY988J1zhr63sFcfsoqUhBP6ozvmkRcUksPNIrIC+vhOJVaxKcEl 7ZiQ== 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=pRATzq6pNPW6/29hFb7lRpuq6JQzE1owYv9tiI6T3Tg=; b=liOtopfZDdmjUVWM0O2maHntc1nGsSc+Au/IuB2eKXamTsv78qKR/rQImgjPcVBdLR JyTCMKaBFk9DcK+olv92ov/GZVATnyh6MucG/BHl01/iCvzZ9c5ORue8ySm0SNM2HQh4 WQBFRzSGD2HLQ4uIvfpi4XeEHerjT3ddaDllNKCF7baoD+2PdMUM7VRZhTnY8eKuTDfx sJaTOu7Mc8S1Em6ixeANLztUtHO+S4aW0rnJM0XFVd+NxWyAQ1xMDO9KAlAFYZZDgIDx pawR5w87MBaRR+jU8OG8FZLPflgmiSn1dA6Tj52C+dYGHj8IFkMTHty8wdMeuSdTQGDL IvJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ugJ7U/Qe"; 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 123si12858653pgi.481.2022.01.24.14.28.52; Mon, 24 Jan 2022 14:29:04 -0800 (PST) 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="ugJ7U/Qe"; 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 S1583413AbiAXWRn (ORCPT + 99 others); Mon, 24 Jan 2022 17:17:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1453953AbiAXVbS (ORCPT ); Mon, 24 Jan 2022 16:31:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03DB6C075949; Mon, 24 Jan 2022 12:20:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5E73B8122F; Mon, 24 Jan 2022 20:20:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC417C340E5; Mon, 24 Jan 2022 20:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055632; bh=sgSscAIfs33is+A3+mF+JxJk+KOnqSxfxISmLEcfSqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugJ7U/QeMWZxAur4U1Us4pkLcMl6lvEA0/IwwvypBJbtaBYfxNntto97LA4RRtgrD phlV9c5Spi3Ox6h6Tsm8W0XYzprR+rmoYNoXa5Qyt21uZdqxgydsDntBfrSYwZt6ng CfqSEuBOGo1UUoHlqjT3omjYuw7ixgNMhrkPZYNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lv Yunlong , Luca Coelho , Sasha Levin Subject: [PATCH 5.15 213/846] wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma Date: Mon, 24 Jan 2022 19:35:30 +0100 Message-Id: <20220124184108.272161843@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 f973795a8d19cbf3d03807704eb7c6ff65788d5a ] In iwl_txq_dyn_alloc_dma, txq->tfds is freed at first time by: iwl_txq_alloc()->goto err_free_tfds->dma_free_coherent(). But it forgot to set txq->tfds to NULL. Then the txq->tfds is freed again in iwl_txq_dyn_alloc_dma by: goto error->iwl_txq_gen2_free_memory()->dma_free_coherent(). My patch sets txq->tfds to NULL after the first free to avoid the double free. Fixes: 0cd1ad2d7fd41 ("iwlwifi: move all bus-independent TX functions to common code") Signed-off-by: Lv Yunlong Link: https://lore.kernel.org/r/20210403054755.4781-1-lyl2019@mail.ustc.edu.cn Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/queue/tx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/intel/iwlwifi/queue/tx.c b/drivers/net/wireless/intel/iwlwifi/queue/tx.c index 451b060693501..0f3526b0c5b00 100644 --- a/drivers/net/wireless/intel/iwlwifi/queue/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/queue/tx.c @@ -1072,6 +1072,7 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num, return 0; err_free_tfds: dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->dma_addr); + txq->tfds = NULL; error: if (txq->entries && cmd_queue) for (i = 0; i < slots_num; i++) -- 2.34.1