From: Arik Nemtsov Date: Wed, 11 Jun 2014 14:18:26 +0000 (+0300) Subject: mac80211: make sure TDLS peer STA exists during setup X-Git-Tag: v3.17-rc1~106^2~73^2~18^2~30 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7adc3e4664bc5bd382fa181e6a4506f5b5b583d8;p=karo-tx-linux.git mac80211: make sure TDLS peer STA exists during setup Make sure userspace added a TDLS peer station before invoking the transmission of the first setup frame. This ensures packets to the peer won't go through the AP path. Signed-off-by: Arik Nemtsov Signed-off-by: Johannes Berg --- diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 6f3a3ad0cb7c..b87e369561f4 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -332,6 +332,19 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev, goto exit; } + /* + * make sure we have a STA representing the peer so we drop or buffer + * non-TDLS-setup frames to the peer. We can't send other packets + * during setup through the AP path + */ + rcu_read_lock(); + if (!sta_info_get(sdata, peer)) { + rcu_read_unlock(); + ret = -ENOLINK; + goto exit; + } + rcu_read_unlock(); + ieee80211_flush_queues(local, sdata); ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer, action_code,