Skip to content

Commit

Permalink
mac80211_hwsim: fix memory leak in hwsim_new_radio_nl
Browse files Browse the repository at this point in the history
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: 92d1338 ("mac80211_hwsim: add PMSR capability support")
Reported-by: [email protected]
Signed-off-by: Zhengchao Shao <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
zhengchaoshao authored and jmberg-intel committed May 16, 2023
1 parent a8938bc commit 098abbd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/virtual/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 098abbd

Please sign in to comment.