Commit b9c061bd authored by Johannes Berg's avatar Johannes Berg Committed by Ben Hutchings

cfg80211/wext: fix message ordering

commit cb150b9d 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: default avatarJohannes Berg <johannes.berg@intel.com>
[bwh: Backported to 3.2:
 - Add default case in cfg80211_netdev_notifier_call() which bypasses
   the added wireless_nlevent_flush() (added upstream by commit
   6784c7db "cfg80211: change return value of notifier function")
 - Adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 6a77bf15
......@@ -442,6 +442,12 @@ extern 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... */
......
......@@ -985,8 +985,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
if (ret)
return notifier_from_errno(ret);
break;
default:
return NOTIFY_DONE;
}
wireless_nlevent_flush();
return NOTIFY_DONE;
}
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment