aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6472c7f928dc..079fc49e3975 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6466,8 +6466,8 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
6466{ 6466{
6467 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 6467 struct cfg80211_registered_device *rdev = info->user_ptr[0];
6468 struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG]; 6468 struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG];
6469 struct cfg80211_wowlan no_triggers = {};
6470 struct cfg80211_wowlan new_triggers = {}; 6469 struct cfg80211_wowlan new_triggers = {};
6470 struct cfg80211_wowlan *ntrig;
6471 struct wiphy_wowlan_support *wowlan = &rdev->wiphy.wowlan; 6471 struct wiphy_wowlan_support *wowlan = &rdev->wiphy.wowlan;
6472 int err, i; 6472 int err, i;
6473 bool prev_enabled = rdev->wowlan; 6473 bool prev_enabled = rdev->wowlan;
@@ -6475,8 +6475,11 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
6475 if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns) 6475 if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns)
6476 return -EOPNOTSUPP; 6476 return -EOPNOTSUPP;
6477 6477
6478 if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) 6478 if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {
6479 goto no_triggers; 6479 cfg80211_rdev_free_wowlan(rdev);
6480 rdev->wowlan = NULL;
6481 goto set_wakeup;
6482 }
6480 6483
6481 err = nla_parse(tb, MAX_NL80211_WOWLAN_TRIG, 6484 err = nla_parse(tb, MAX_NL80211_WOWLAN_TRIG,
6482 nla_data(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]), 6485 nla_data(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),
@@ -6587,22 +6590,15 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
6587 } 6590 }
6588 } 6591 }
6589 6592
6590 if (memcmp(&new_triggers, &no_triggers, sizeof(new_triggers))) { 6593 ntrig = kmemdup(&new_triggers, sizeof(new_triggers), GFP_KERNEL);
6591 struct cfg80211_wowlan *ntrig; 6594 if (!ntrig) {
6592 ntrig = kmemdup(&new_triggers, sizeof(new_triggers), 6595 err = -ENOMEM;
6593 GFP_KERNEL); 6596 goto error;
6594 if (!ntrig) {
6595 err = -ENOMEM;
6596 goto error;
6597 }
6598 cfg80211_rdev_free_wowlan(rdev);
6599 rdev->wowlan = ntrig;
6600 } else {
6601 no_triggers:
6602 cfg80211_rdev_free_wowlan(rdev);
6603 rdev->wowlan = NULL;
6604 } 6597 }
6598 cfg80211_rdev_free_wowlan(rdev);
6599 rdev->wowlan = ntrig;
6605 6600
6601 set_wakeup:
6606 if (rdev->ops->set_wakeup && prev_enabled != !!rdev->wowlan) 6602 if (rdev->ops->set_wakeup && prev_enabled != !!rdev->wowlan)
6607 rdev->ops->set_wakeup(&rdev->wiphy, rdev->wowlan); 6603 rdev->ops->set_wakeup(&rdev->wiphy, rdev->wowlan);
6608 6604