Re: [PATCH v2] wifi: ath11k: fix memory leaks in beacon template setup

Zilin Guan <[email protected]>
Newsgroups org.infradead.lists.ath11k,org.kernel.vger.linux-kernel,org.kernel.vger.linux-wireless
Message-ID <[email protected]>
On Thu, Jan 29, 2026 at 07:36:43AM -0800, Jeff Johnson wrote:
> I prefer strict logical consistency so I prefer either adding the goto or
> removing the beacons->cnt check.
> 
> Or a completely different approach would be to use cleanup.h functionality and
> annotate beacons with __free(ieee80211_beacon_free_ema_list) so that no
> explicit calls to that function are required. If you try this approach then
> beacons must be defined at the point of allocation:
> 
> 	struct ieee80211_ema_beacons *beacons __free(ieee80211_beacon_free_ema_list) =
> 		ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
> 						       tx_arvif->vif, 0);
> 
> Note that I have not tried this approach with allocations other than from the
> kmalloc() family with __free(kfree), but in theory this should work.
> 
> /jeff

Thanks! I'll add the goto path for the beacons->cnt check in v3.

Best regards,
Zilin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.