netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl
@ 2023-05-15  9:22 Zhengchao Shao
  2023-05-15 11:01 ` Kalle Valo
  2023-05-15 13:05 ` Simon Horman
  0 siblings, 2 replies; 4+ messages in thread
From: Zhengchao Shao @ 2023-05-15  9:22 UTC (permalink / raw)
  To: linux-wireless, netdev, johannes, kvalo, davem, edumazet, kuba,
	pabeni
  Cc: jaewan, steen.hegelund, weiyongjun1, yuehaibing, shaozhengchao,
	syzbot+904ce6fbb38532d9795c

When parse_pmsr_capa failed in hwsim_new_radio_nl, the memory resources
applied for by pmsr_capa are not released. Add release processing to the
incorrect path.

Fixes: 92d13386ec55 ("mac80211_hwsim: add PMSR capability support")
Reported-by: syzbot+904ce6fbb38532d9795c@syzkaller.appspotmail.com
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
v2: move the value assigned to pmsr_capa before parse_pmsr_capa
---
 drivers/net/wireless/virtual/mac80211_hwsim.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index 9a8faaf4c6b6..89c7a1420381 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -5964,10 +5964,11 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
 			ret = -ENOMEM;
 			goto out_free;
 		}
+		param.pmsr_capa = pmsr_capa;
+
 		ret = parse_pmsr_capa(info->attrs[HWSIM_ATTR_PMSR_SUPPORT], pmsr_capa, info);
 		if (ret)
 			goto out_free;
-		param.pmsr_capa = pmsr_capa;
 	}
 
 	ret = mac80211_hwsim_new_radio(info, &param);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl
  2023-05-15  9:22 [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl Zhengchao Shao
@ 2023-05-15 11:01 ` Kalle Valo
  2023-05-15 11:07   ` shaozhengchao
  2023-05-15 13:05 ` Simon Horman
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2023-05-15 11:01 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: linux-wireless, netdev, johannes, davem, edumazet, kuba, pabeni,
	jaewan, steen.hegelund, weiyongjun1, yuehaibing,
	syzbot+904ce6fbb38532d9795c

Zhengchao Shao <shaozhengchao@huawei.com> writes:

> When parse_pmsr_capa failed in hwsim_new_radio_nl, the memory resources
> applied for by pmsr_capa are not released. Add release processing to the
> incorrect path.
>
> Fixes: 92d13386ec55 ("mac80211_hwsim: add PMSR capability support")
> Reported-by: syzbot+904ce6fbb38532d9795c@syzkaller.appspotmail.com
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
> v2: move the value assigned to pmsr_capa before parse_pmsr_capa
> ---
>  drivers/net/wireless/virtual/mac80211_hwsim.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

drivers/net/wireless changes go to wireless-next, not net-next. But no
need to resend because of this.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl
  2023-05-15 11:01 ` Kalle Valo
@ 2023-05-15 11:07   ` shaozhengchao
  0 siblings, 0 replies; 4+ messages in thread
From: shaozhengchao @ 2023-05-15 11:07 UTC (permalink / raw)
  To: Kalle Valo
  Cc: linux-wireless, netdev, johannes, davem, edumazet, kuba, pabeni,
	jaewan, steen.hegelund, weiyongjun1, yuehaibing,
	syzbot+904ce6fbb38532d9795c



On 2023/5/15 19:01, Kalle Valo wrote:
> Zhengchao Shao <shaozhengchao@huawei.com> writes:
> 
>> When parse_pmsr_capa failed in hwsim_new_radio_nl, the memory resources
>> applied for by pmsr_capa are not released. Add release processing to the
>> incorrect path.
>>
>> Fixes: 92d13386ec55 ("mac80211_hwsim: add PMSR capability support")
>> Reported-by: syzbot+904ce6fbb38532d9795c@syzkaller.appspotmail.com
>> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>> ---
>> v2: move the value assigned to pmsr_capa before parse_pmsr_capa
>> ---
>>   drivers/net/wireless/virtual/mac80211_hwsim.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> drivers/net/wireless changes go to wireless-next, not net-next. But no
> need to resend because of this.
> 

Thank you for the reminder. I will pay attention next time.

Zhengchao Shao

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl
  2023-05-15  9:22 [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl Zhengchao Shao
  2023-05-15 11:01 ` Kalle Valo
@ 2023-05-15 13:05 ` Simon Horman
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-05-15 13:05 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: linux-wireless, netdev, johannes, kvalo, davem, edumazet, kuba,
	pabeni, jaewan, steen.hegelund, weiyongjun1, yuehaibing,
	syzbot+904ce6fbb38532d9795c

On Mon, May 15, 2023 at 05:22:27PM +0800, Zhengchao Shao wrote:
> When parse_pmsr_capa failed in hwsim_new_radio_nl, the memory resources
> applied for by pmsr_capa are not released. Add release processing to the
> incorrect path.
> 
> Fixes: 92d13386ec55 ("mac80211_hwsim: add PMSR capability support")
> Reported-by: syzbot+904ce6fbb38532d9795c@syzkaller.appspotmail.com
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
> v2: move the value assigned to pmsr_capa before parse_pmsr_capa

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-15 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-15  9:22 [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl Zhengchao Shao
2023-05-15 11:01 ` Kalle Valo
2023-05-15 11:07   ` shaozhengchao
2023-05-15 13:05 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).