diff options
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c2a40a2e56bd..334697de5cc0 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -6591,19 +6591,30 @@ static struct genl_multicast_group nl80211_testmode_mcgrp = { | |||
6591 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) | 6591 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) |
6592 | { | 6592 | { |
6593 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 6593 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
6594 | struct wireless_dev *wdev = | ||
6595 | __cfg80211_wdev_from_attrs(genl_info_net(info), info->attrs); | ||
6594 | int err; | 6596 | int err; |
6595 | 6597 | ||
6598 | if (!rdev->ops->testmode_cmd) | ||
6599 | return -EOPNOTSUPP; | ||
6600 | |||
6601 | if (IS_ERR(wdev)) { | ||
6602 | err = PTR_ERR(wdev); | ||
6603 | if (err != -EINVAL) | ||
6604 | return err; | ||
6605 | wdev = NULL; | ||
6606 | } else if (wdev->wiphy != &rdev->wiphy) { | ||
6607 | return -EINVAL; | ||
6608 | } | ||
6609 | |||
6596 | if (!info->attrs[NL80211_ATTR_TESTDATA]) | 6610 | if (!info->attrs[NL80211_ATTR_TESTDATA]) |
6597 | return -EINVAL; | 6611 | return -EINVAL; |
6598 | 6612 | ||
6599 | err = -EOPNOTSUPP; | 6613 | rdev->testmode_info = info; |
6600 | if (rdev->ops->testmode_cmd) { | 6614 | err = rdev_testmode_cmd(rdev, wdev, |
6601 | rdev->testmode_info = info; | ||
6602 | err = rdev_testmode_cmd(rdev, | ||
6603 | nla_data(info->attrs[NL80211_ATTR_TESTDATA]), | 6615 | nla_data(info->attrs[NL80211_ATTR_TESTDATA]), |
6604 | nla_len(info->attrs[NL80211_ATTR_TESTDATA])); | 6616 | nla_len(info->attrs[NL80211_ATTR_TESTDATA])); |
6605 | rdev->testmode_info = NULL; | 6617 | rdev->testmode_info = NULL; |
6606 | } | ||
6607 | 6618 | ||
6608 | return err; | 6619 | return err; |
6609 | } | 6620 | } |