[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230515092227.2691437-1-shaozhengchao@huawei.com>
Date: Mon, 15 May 2023 17:22:27 +0800
From: Zhengchao Shao <shaozhengchao@...wei.com>
To: <linux-wireless@...r.kernel.org>, <netdev@...r.kernel.org>,
<johannes@...solutions.net>, <kvalo@...nel.org>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>
CC: <jaewan@...gle.com>, <steen.hegelund@...rochip.com>,
<weiyongjun1@...wei.com>, <yuehaibing@...wei.com>,
<shaozhengchao@...wei.com>,
<syzbot+904ce6fbb38532d9795c@...kaller.appspotmail.com>
Subject: [PATCH net-next,v2] mac80211_hwsim: fix memory leak in hwsim_new_radio_nl
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@...kaller.appspotmail.com
Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.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, ¶m);
--
2.34.1
Powered by blists - more mailing lists