Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3715455pxb; Mon, 24 Jan 2022 16:09:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8WkHea+kt3EyHR2kBQIdUgEYsudJX/UmL4B4chzqq2P1YD4ckGd0bqnOk4Uk7cGd+4mwr X-Received: by 2002:a17:902:7c82:b0:14a:e210:f2d6 with SMTP id y2-20020a1709027c8200b0014ae210f2d6mr16465419pll.74.1643069351867; Mon, 24 Jan 2022 16:09:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069351; cv=none; d=google.com; s=arc-20160816; b=CRXMQBydL7xj8vBOzTF8Uzh0Qb8cGCf8pdAgSjwMurAMEixpwyOhLWZItXrBjlghHY /hfMaXUpCH1F2A6pi9hZrAJ2Os1lmRNjUyYuS0NwKtwx1lQyeeY5eCmVWJ4GrkhF313L CDk3K7o0R3ouYJHkBSzxj3Au1JVb1XR0+2YD6aBRR5wikkDE6WWBZdl91PpBHCsJ3/BH vQlxlirhYnz68mQe9VQveNZQJj9l04u4NKurK+6zUX+DLmc47eyBnr+zMK1sAHOoLiTV W+EH1kSO+Ce3iY4NLJyKTe1p/cTV+0UKDzBXIaq3ow/3EVtMKbVGPN+D1an6ZY3+1azu NYcg== 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=smPvDZqPE/TU1he3gmCcqrLQ6I9xEYlLhm1zTvNa5oO5KBPdGoIevYSWkDkekvPgfu zwNA2msf0YurO1FxyCleWUYE2L41mUJfZSKrGdhmgt8ifSRtYH3fN8gziu2aakZBD7MR 3lQskAxT0HQ1+572nyfxDoTt+cDCLBpMrCvCFI+hzo6/rMJjzOVHZ5lPK8roacGBoTt1 E+oWRnNB9kZgyvgj4ZABzVTm0IFMLkjXvHFhGXed7ezH+XzrReKjCKyvojl5yc/PdvkB tGGXn3HFIYXWXKHdKDxDYnt+qbCuHE6OfRl7svAfzPKFRBe5liVsNegiPjfFSGWUQnQX Leew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WvMmriGt; 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 z17si15416716pgk.199.2022.01.24.16.08.59; Mon, 24 Jan 2022 16:09:11 -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=WvMmriGt; 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 S1387643AbiAYAFD (ORCPT + 99 others); Mon, 24 Jan 2022 19:05:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382872AbiAXWlx (ORCPT ); Mon, 24 Jan 2022 17:41:53 -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 D6371C06B5A3; Mon, 24 Jan 2022 13:05:20 -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 93995B815A3; Mon, 24 Jan 2022 21:05:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B57C1C340E5; Mon, 24 Jan 2022 21:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058318; bh=sgSscAIfs33is+A3+mF+JxJk+KOnqSxfxISmLEcfSqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvMmriGtzShToeVfXl8+lY+OsBBh06S8mXMLxqfprRBgpwm6R9lS2dwJTb6vp7Quj vTPywwIatTjkC3SL63VDySVPumA70mQc/h6Y809fEAACBqCyzhnugks5H2VU3mq11v aaMd5PAxVKRK0DNQ4+vD7bMgYAZDE0U3jKvKXlQs= 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.16 0250/1039] wireless: iwlwifi: Fix a double free in iwl_txq_dyn_alloc_dma Date: Mon, 24 Jan 2022 19:33:59 +0100 Message-Id: <20220124184133.736087294@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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