mac80211_hwsim: Fix memory leak in hwsim_new_radio_nl()
authorBen Hutchings <ben.hutchings@codethink.co.uk>
Fri, 10 Nov 2017 18:48:50 +0000 (18:48 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:53:07 +0000 (09:53 +0100)
commit266fd76296bea9f392ae205e7a08f5f5726dc7f9
treea9d7cdce352b1b0f56dbeac6256adbab35610666
parentad7acca17e31d14ceca8824728440e727150ddd0
mac80211_hwsim: Fix memory leak in hwsim_new_radio_nl()

[ Upstream commit 67bd52386125ce1159c0581cbcd2740addf33cd4 ]

hwsim_new_radio_nl() now copies the name attribute in order to add a
null-terminator.  mac80211_hwsim_new_radio() (indirectly) copies it
again into the net_device structure, so the first copy is not used or
freed later.  Free the first copy before returning.

Fixes: ff4dd73dd2b4 ("mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length")
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/mac80211_hwsim.c