]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cfg80211/wext: fix message ordering
authorJohannes Berg <johannes.berg@intel.com>
Wed, 27 Jan 2016 12:29:34 +0000 (13:29 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Thu, 24 Mar 2016 10:01:07 +0000 (10:01 +0000)
commit cb150b9d23be6ee7f3a0fff29784f1c5b5ac514d upstream.

Since cfg80211 frequently takes actions from its netdev notifier
call, wireless extensions messages could still be ordered badly
since the wext netdev notifier, since wext is built into the
kernel, runs before the cfg80211 netdev notifier. For example,
the following can happen:

5: wlan1: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default
    link/ether 02:00:00:00:01:00 brd ff:ff:ff:ff:ff:ff
5: wlan1: <BROADCAST,MULTICAST,UP>
    link/ether

when setting the interface down causes the wext message.

To also fix this, export the wireless_nlevent_flush() function
and also call it from the cfg80211 notifier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
include/net/iw_handler.h
net/wireless/core.c
net/wireless/wext-core.c

index a830b01baba4b08a1d5054557c540312084b8f50..e8aa72eaded5a0fbf8bb71a17299f9847d2dad2a 100644 (file)
@@ -439,6 +439,12 @@ int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length);
 /* Send a single event to user space */
 void wireless_send_event(struct net_device *dev, unsigned int cmd,
                         union iwreq_data *wrqu, const char *extra);
+#ifdef CONFIG_WEXT_CORE
+/* flush all previous wext events - if work is done from netdev notifiers */
+void wireless_nlevent_flush(void);
+#else
+static inline void wireless_nlevent_flush(void) {}
+#endif
 
 /* We may need a function to send a stream of events to user space.
  * More on that later... */
index a1c40654dd9b1ca9b47bbaef6682ee6d49147e66..59bc2ff8cfc59ed696eeaf45562f3f5b1d97f294 100644 (file)
@@ -1048,6 +1048,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                return NOTIFY_DONE;
        }
 
+       wireless_nlevent_flush();
+
        return NOTIFY_OK;
 }
 
index 87dd619fb2e92917cbd348286a6082c33a51906d..b50ee5d622e14d4fb486ce0c533757e958702f54 100644 (file)
@@ -342,7 +342,7 @@ static const int compat_event_type_size[] = {
 
 /* IW event code */
 
-static void wireless_nlevent_flush(void)
+void wireless_nlevent_flush(void)
 {
        struct sk_buff *skb;
        struct net *net;
@@ -355,6 +355,7 @@ static void wireless_nlevent_flush(void)
                                    GFP_KERNEL);
        }
 }
+EXPORT_SYMBOL_GPL(wireless_nlevent_flush);
 
 static int wext_netdev_notifier_call(struct notifier_block *nb,
                                     unsigned long state, void *ptr)