cfg80211: check vendor command doit pointer before use
authorJulian Squires <julian@cipht.net>
Mon, 6 Jul 2020 21:13:53 +0000 (17:13 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 09:01:54 +0000 (11:01 +0200)
commit71a5362de8d9143dd195a068bee8f3870ede2f63
tree0e071ddba6ea0c9e92cb1abe673c140b5a07ccce
parent705a601e0561be274d34cb25545764a8abaa5bf8
cfg80211: check vendor command doit pointer before use

[ Upstream commit 4052d3d2e8f47a15053320bbcbe365d15610437d ]

In the case where a vendor command does not implement doit, and has no
flags set, doit would not be validated and a NULL pointer dereference
would occur, for example when invoking the vendor command via iw.

I encountered this while developing new vendor commands.  Perhaps in
practice it is advisable to always implement doit along with dumpit,
but it seems reasonable to me to always check doit anyway, not just
when NEED_WDEV.

Signed-off-by: Julian Squires <julian@cipht.net>
Link: https://lore.kernel.org/r/20200706211353.2366470-1-julian@cipht.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/wireless/nl80211.c