diff options
author | Johannes Berg | 2014-01-07 23:21:34 +0100 |
---|---|---|
committer | Johannes Berg | 2014-01-10 20:12:58 +0100 |
commit | 85ca8fc74671def6041fb12c0a7d3423da56ffd3 (patch) | |
tree | 933e2c462951f7ad364be6edef2ad96f6bffd207 /drivers | |
parent | mac80211_hwsim: shuffle code to prepare for dynamic radios (diff) | |
download | kernel-qcow2-linux-85ca8fc74671def6041fb12c0a7d3423da56ffd3.tar.gz kernel-qcow2-linux-85ca8fc74671def6041fb12c0a7d3423da56ffd3.tar.xz kernel-qcow2-linux-85ca8fc74671def6041fb12c0a7d3423da56ffd3.zip |
mac80211_hwsim: verify wmediumd socket
There can't be two wmediumd instances controlling hwsim,
so reject registration from a second one and verify in
the commands that it's the correct instance calling.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 1c51c33c385f..4ee88a9b095d 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2112,6 +2112,9 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, int i; bool found = false; + if (info->snd_portid != wmediumd_portid) + return -EINVAL; + if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || !info->attrs[HWSIM_ATTR_FLAGS] || !info->attrs[HWSIM_ATTR_COOKIE] || @@ -2185,6 +2188,9 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, void *frame_data; struct sk_buff *skb = NULL; + if (info->snd_portid != wmediumd_portid) + return -EINVAL; + if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] || !info->attrs[HWSIM_ATTR_FRAME] || !info->attrs[HWSIM_ATTR_RX_RATE] || @@ -2237,6 +2243,9 @@ out: static int hwsim_register_received_nl(struct sk_buff *skb_2, struct genl_info *info) { + if (wmediumd_portid) + return -EBUSY; + wmediumd_portid = info->snd_portid; printk(KERN_DEBUG "mac80211_hwsim: received a REGISTER, " |