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)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 20 Nov 2017 15:57:15 +0000 (16:57 +0100)
commit67bd52386125ce1159c0581cbcd2740addf33cd4
tree5be55da42a111f6546deb88f82030a8afdf3fbaa
parentd7be102f2945a626f55e0501e52bb31ba3e77b81
mac80211_hwsim: Fix memory leak in hwsim_new_radio_nl()

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>
drivers/net/wireless/mac80211_hwsim.c