Thread (12 messages) 12 messages, 3 authors, 2021-07-23

Re: [PATCH] cfg80211: free the object allocated in wiphy_apply_custom_regulatory

flat view

From: Dongliang Mu <hidden>
Date: 2021-07-23 09:31:19
Also in: linux-wireless, lkml

On Fri, Jul 23, 2021 at 5:18 PM Johannes Berg [off-list ref] wrote:
On Fri, 2021-07-23 at 17:13 +0800, Dongliang Mu wrote:
quoted
On Fri, Jul 23, 2021 at 4:37 PM Johannes Berg [off-list ref] wrote:
quoted
On Fri, 2021-07-23 at 13:09 +0800, Dongliang Mu wrote:
quoted
The commit beee24695157 ("cfg80211: Save the regulatory domain when
setting custom regulatory") forgets to free the newly allocated regd
object.
Not really? It's not forgetting it, it just saves it?
Yes, it saves the regd object in the function wiphy_apply_custom_regulatory.
Right.
quoted
But its parent function - mac80211_hwsim_new_radio forgets to free
this object when the ieee80211_register_hw fails.
But why is this specific to mac80211-hwsim?

Any other code calling wiphy_apply_custom_regulatory() and then failing
the subsequent wiphy_register() or otherwise calling wiphy_free() will
run into the same situation.

So why wouldn't we free this in wiphy_free(), if it exists?
Hi Johannes,

if zhao in the thread is right, we don't need to add this free
operation to wiphy_free().

What we should do is to only handle regd in the error handling code of
mac80211_hwsim_new_radio. This will not affect other users of
mac80211-hwsim. Any idea?
johannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help