From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795029260; b=gtrfdKYk+bROYSrng3CdwCscgWVD5T+RMoCowXSbFgdvXqycDCePe6JObZfDponRqawX irSFPVyJOJiEkZCA2jKM+re1zjHmi6M3Kmyd2c/RrLU/niH4AKplWnP8RW65oA/HnCekG uClXzNbUbdpCWzSoOM6tRO1UreOHlq9OpoM8ASur3Tq0AVjFpQ80aN8ShwNErU2S5r2Ct Ni59FvPm65GX4fQF+OH4hSGuOUd0y54ZvsI63rmv7nf8c/YkmY1+IdPJKTQu/ApVVqB5b Y6oDa0sr05I7Wc6WPY3UX4QIZpLu36IpyvnxRMjrby8O7xS/XeBOMv3SyTpkWMpCc3w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795029260; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=fujv/Wss0AftbriWkg3O1iLPPoVJeuWGCPyYsEBsdEo=; b=QyWCL5EALwgTjONE8R7rNQcNq7T6xWCjGEB7UoVHGmqwZ/QCNJ3u4bTh56Wth8LK+b21 EuJ26qhUyB+wmAqme3gENc5R4Pn0Nu1+Mh4RGS8RGs8JuQ8Nolfv487hCjx+4VdwD409U yrKzcuOhHzOEhY5oiZiRoyGCFX0URSgd2LVhQROPmdAFX3Zp8pkOP4jxTZB1COh/XDVDJ 7od5CFB1VnPLICJS5LUMXdCy8ZVh+uO5hdegPSnjNTYnM8/f8SNSuP+G6JjJmRKJIIHlB Uur/pzHARTQBHWYjSQUGwynlyXP/580HJZc8Fyb2hKsBsVsqK1V2p9lqMT++H5zhLfg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=qElA7EGX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EF32606A33A; Wed, 18 Nov 2026 19:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=qElA7EGX Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4C181F000C4; Wed, 18 Nov 2026 19:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795029260; bh=fujv/Wss0AftbriWkg3O1iLPPoVJeuWGCPyYsEBsdEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qElA7EGXoNlDqnzPW4gjhy3TX6l+nDZpPTgdf5InB6oFSRkC1OZbot9P/UcPH/TB9 k14PGkpbz7S5EdWPu7NdFYPzcv6uxW6+eYUB324zZMIZ0Wk4r8Hf6cLLi6U0EjqjDB 7g+xmkdY4t5a0vaMt4JTCJLZX7eU2BjyVSPo3D1k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Baochen Qiang , Nicolas Escande , Rameshkumar Sundaram , Jeff Johnson , Sasha Levin Subject: [PATCH 6.12 0287/1756] wifi: ath11k: fix locking problem in ath11k_dp_rx_tid_del_func() Date: Wed, 18 Nov 2026 15:40:14 +0100 Message-ID: <20261118150019.822062749@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150007.957976754@linuxfoundation.org> References: <20261118150007.957976754@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolas Escande [ Upstream commit c7555d47b1d051e0406474349deccf74b491ae01 ] In this function, we iterate over dp->reo_cmd_cache_flush_list using list_for_each_entry_safe(), under dp->reo_cmd_lock for concurrent access, and for each expired entries we : - drop the lock - call ath11k_dp_reo_cache_flush() - kfree() the entry - retake the lock to keep on iterating list_for_each_entry_safe() protects us from deleting the entry during iteration but doesn't protect for concurrent access. So another thread can take the lock and modify the list in between and crash like below. To fix the issue, move all entries that needs to be freed to a local list while under the lock and then iterate over the list to free the entries without holding the lock. BUG: Unable to handle kernel paging request at virtual address 00000010ddbeef8c Call trace: ath11k_dp_rx_tid_del_func+0x164/0x3c8 ath11k_dp_process_reo_status+0x1d4/0x2fc ath11k_dp_service_srng+0x334/0x338 ath11k_pcic_ext_grp_napi_poll+0x30/0xc0 __napi_poll+0x34/0x184 napi_threaded_poll+0xb4/0x1d8 kthread+0xdc/0xe0 ret_from_fork+0x10/0x20 Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.9.0.1-01977-QCAHKSWPL_SILICONZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Suggested-by: Baochen Qiang Signed-off-by: Nicolas Escande Reviewed-by: Baochen Qiang Reviewed-by: Rameshkumar Sundaram Link: https://patch.msgid.link/20260813-ath11k-locking-v2-1-f4113a0bd0f4@gmail.com Signed-off-by: Jeff Johnson Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/dp_rx.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index 9344d3f1f45da..077ded7f15da5 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -762,6 +762,9 @@ static void ath11k_dp_rx_tid_del_func(struct ath11k_dp *dp, void *ctx, struct ath11k_base *ab = dp->ab; struct dp_rx_tid *rx_tid = ctx; struct dp_reo_cache_flush_elem *elem, *tmp; + struct list_head flush_list; + + INIT_LIST_HEAD(&flush_list); if (status == HAL_REO_CMD_DRAIN) { goto free_desc; @@ -783,23 +786,25 @@ static void ath11k_dp_rx_tid_del_func(struct ath11k_dp *dp, void *ctx, list_add_tail(&elem->list, &dp->reo_cmd_cache_flush_list); dp->reo_cmd_cache_flush_count++; - /* Flush and invalidate aged REO desc from HW cache */ + /* identify aged REO desc that needs removal */ list_for_each_entry_safe(elem, tmp, &dp->reo_cmd_cache_flush_list, list) { if (dp->reo_cmd_cache_flush_count > DP_REO_DESC_FREE_THRESHOLD || time_after(jiffies, elem->ts + msecs_to_jiffies(DP_REO_DESC_FREE_TIMEOUT_MS))) { - list_del(&elem->list); + list_move_tail(&elem->list, &flush_list); dp->reo_cmd_cache_flush_count--; - spin_unlock_bh(&dp->reo_cmd_lock); - - ath11k_dp_reo_cache_flush(ab, &elem->data); - kfree(elem); - spin_lock_bh(&dp->reo_cmd_lock); } } spin_unlock_bh(&dp->reo_cmd_lock); + /* remove aged REO desc from HW */ + list_for_each_entry_safe(elem, tmp, &flush_list, list) { + ath11k_dp_reo_cache_flush(ab, &elem->data); + list_del(&elem->list); + kfree(elem); + } + return; free_desc: dma_free_noncoherent(ab->dev, rx_tid->unaligned_size, -- 2.53.0