Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cfg80211/wext: fix message ordering

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.

Cc: stable@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+10 -1
+6
include/net/iw_handler.h
··· 439 439 /* Send a single event to user space */ 440 440 void wireless_send_event(struct net_device *dev, unsigned int cmd, 441 441 union iwreq_data *wrqu, const char *extra); 442 + #ifdef CONFIG_WEXT_CORE 443 + /* flush all previous wext events - if work is done from netdev notifiers */ 444 + void wireless_nlevent_flush(void); 445 + #else 446 + static inline void wireless_nlevent_flush(void) {} 447 + #endif 442 448 443 449 /* We may need a function to send a stream of events to user space. 444 450 * More on that later... */
+2
net/wireless/core.c
··· 1147 1147 return NOTIFY_DONE; 1148 1148 } 1149 1149 1150 + wireless_nlevent_flush(); 1151 + 1150 1152 return NOTIFY_OK; 1151 1153 } 1152 1154
+2 -1
net/wireless/wext-core.c
··· 342 342 343 343 /* IW event code */ 344 344 345 - static void wireless_nlevent_flush(void) 345 + void wireless_nlevent_flush(void) 346 346 { 347 347 struct sk_buff *skb; 348 348 struct net *net; ··· 355 355 GFP_KERNEL); 356 356 } 357 357 } 358 + EXPORT_SYMBOL_GPL(wireless_nlevent_flush); 358 359 359 360 static int wext_netdev_notifier_call(struct notifier_block *nb, 360 361 unsigned long state, void *ptr)