[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <29bf2e9c-ca24-46d1-93e4-3b3f3f812705@quicinc.com>
Date: Fri, 30 Aug 2024 09:01:36 -0700
From: Jeff Johnson <quic_jjohnson@...cinc.com>
To: Jiawei Ye <jiawei.ye@...mail.com>, <kvalo@...nel.org>,
<jjohnson@...nel.org>, <corbet@....net>
CC: <linux-wireless@...r.kernel.org>, <ath11k@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ath11k: Fix potential RCU dereference issue in
ath11k_debugfs_htt_ext_stats_handler
On 8/30/2024 5:02 AM, Jiawei Ye wrote:
> In the `ath11k_debugfs_htt_ext_stats_handler` function, the `ar` pointer
> obtained via RCU lock is accessed after the RCU read-side critical
> section might be unlocked. According to RCU usage rules, this is illegal.
> Reusing this pointer can lead to unpredictable behavior, including
> accessing memory that has been updated or causing use-after-free issues.
> The `ath12k_debugfs_htt_ext_stats_handler` function in the
> `drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c` file provides a good
> example to follow for addressing this issue.
>
> This possible bug was identified using a static analysis tool developed
> by myself, specifically designed to detect RCU-related issues.
>
> To address this issue, the RCU read lock is now kept until all accesses
> to the `ar` pointer are completed. A `goto exit` statement is introduced
> to ensure that the RCU read unlock is called appropriately, regardless of
> the function's exit path.
This analysis is incorrect since ar is not an RCU-protected structure
The rcu_read_lock() is required internally within
ath11k_mac_get_ar_by_pdev_id() when retrieving the RCU-protected pdev pointer.
So NAK this patch.
Powered by blists - more mailing lists