lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6fa2aecc-ab64-894d-77c2-0a19b524cc03@gmail.com>
Date:   Fri, 23 Jul 2021 17:18:33 +0800
From:   xiaoqiang zhao <zhaoxiaoqiang007@...il.com>
To:     Dongliang Mu <mudongliangabcd@...il.com>,
        Johannes Berg <johannes@...solutions.net>,
        Kalle Valo <kvalo@...eaurora.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Luca Coelho <luciano.coelho@...el.com>,
        Ilan Peer <ilan.peer@...el.com>
Cc:     syzbot+1638e7c770eef6b6c0d0@...kaller.appspotmail.com,
        Johannes Berg <johannes.berg@...el.com>,
        linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cfg80211: free the object allocated in
 wiphy_apply_custom_regulatory



在 2021/7/23 13:09, Dongliang Mu 写道:
> The commit beee24695157 ("cfg80211: Save the regulatory domain when
> setting custom regulatory") forgets to free the newly allocated regd
> object.
> 
> Fix this by freeing the regd object in the error handling code and
> deletion function - mac80211_hwsim_del_radio.
> 
> Reported-by: syzbot+1638e7c770eef6b6c0d0@...kaller.appspotmail.com
> Fixes: beee24695157 ("cfg80211: Save the regulatory domain when setting custom regulatory")
> Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
> ---
>  drivers/net/wireless/mac80211_hwsim.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
> index ffa894f7312a..20b870af6356 100644
> --- a/drivers/net/wireless/mac80211_hwsim.c
> +++ b/drivers/net/wireless/mac80211_hwsim.c
> @@ -3404,6 +3404,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
>  	debugfs_remove_recursive(data->debugfs);
>  	ieee80211_unregister_hw(data->hw);
>  failed_hw:
> +	if (param->regd)
> +		kfree_rcu(get_wiphy_regdom(data->hw->wiphy));
>  	device_release_driver(data->dev);

hw->wiphy->regd may be NULL if previous reg_copy_regd failed, so how about:
if (hw->wiphy->regd)
	rcu_free_regdom(get_wiphy_regdom(hw->wiphy))	

>  failed_bind:
>  	device_unregister(data->dev);
> @@ -3454,6 +3456,8 @@ static void mac80211_hwsim_del_radio(struct mac80211_hwsim_data *data,
>  {
>  	hwsim_mcast_del_radio(data->idx, hwname, info);
>  	debugfs_remove_recursive(data->debugfs);
> +	if (data->regd)
> +		kfree_rcu(get_wiphy_regdom(data->hw->wiphy));
this is not correct, because ieee80211_unregister_hw below will free
data->hw_wiphy->regd
>  	ieee80211_unregister_hw(data->hw);
>  	device_release_driver(data->dev);
>  	device_unregister(data->dev);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ