Skip to content

Commit 6d5202f

Browse files
jmberg-intelsashalevin
authored andcommitted
cfg80211/wext: fix message ordering
[ Upstream commit cb150b9 ] 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: [email protected] Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 746ba2e commit 6d5202f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

include/net/iw_handler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,12 @@ int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length);
439439
/* Send a single event to user space */
440440
void wireless_send_event(struct net_device *dev, unsigned int cmd,
441441
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
442448

443449
/* We may need a function to send a stream of events to user space.
444450
* More on that later... */

net/wireless/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
11381138
return NOTIFY_DONE;
11391139
}
11401140

1141+
wireless_nlevent_flush();
1142+
11411143
return NOTIFY_OK;
11421144
}
11431145

net/wireless/wext-core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static const int compat_event_type_size[] = {
342342

343343
/* IW event code */
344344

345-
static void wireless_nlevent_flush(void)
345+
void wireless_nlevent_flush(void)
346346
{
347347
struct sk_buff *skb;
348348
struct net *net;
@@ -355,6 +355,7 @@ static void wireless_nlevent_flush(void)
355355
GFP_KERNEL);
356356
}
357357
}
358+
EXPORT_SYMBOL_GPL(wireless_nlevent_flush);
358359

359360
static int wext_netdev_notifier_call(struct notifier_block *nb,
360361
unsigned long state, void *ptr)

0 commit comments

Comments
 (0)