nl80211/mac80211: allow non-linear skb in rx_control_port
authorDenis Kenzior <denkenz@gmail.com>
Tue, 3 Jul 2018 20:05:48 +0000 (15:05 -0500)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 6 Jul 2018 12:34:42 +0000 (14:34 +0200)
commita948f713842ad5c23f125efc61dee6951893219c
treee00954fd546b1415958c866e374861a0bfd90496
parent19103a4bfb42f320395daa5616ece3e89e759d63
nl80211/mac80211: allow non-linear skb in rx_control_port

The current implementation of cfg80211_rx_control_port assumed that the
caller could provide a contiguous region of memory for the control port
frame to be sent up to userspace.  Unfortunately, many drivers produce
non-linear skbs, especially for data frames.  This resulted in userspace
getting notified of control port frames with correct metadata (from
address, port, etc) yet garbage / nonsense contents, resulting in bad
handshakes, disconnections, etc.

mac80211 linearizes skbs containing management frames.  But it didn't
seem worthwhile to do this for control port frames.  Thus the signature
of cfg80211_rx_control_port was changed to take the skb directly.
nl80211 then takes care of obtaining control port frame data directly
from the (linear | non-linear) skb.

The caller is still responsible for freeing the skb,
cfg80211_rx_control_port does not take ownership of it.

Fixes: 6a671a50f819 ("nl80211: Add CMD_CONTROL_PORT_FRAME API")
Signed-off-by: Denis Kenzior <denkenz@gmail.com>
[fix some kernel-doc formatting, add fixes tag]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/mac80211/rx.c
net/wireless/nl80211.c
net/wireless/trace.h