aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2009-07-20 04:12:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:29 -0400
commit1e056665e878ce4f91dbfd594f4ebba49ea689c0 (patch)
tree596939e206e806cec40bd04f3d3d1c6dcc1822e1 /net/wireless
parent971ad01169398170976951d3a9479a29d231c734 (diff)
cfg80211: avoid setting default_key if add_key fails
In cfg80211_upload_connect_keys(), we call add_key, set_default_key and set_default_mgmt_key (if applicable) one by one. If one of these operations fails, we should stop calling the following functions. Because if the key is not added successfully, we should not set it as default key anyway. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 4bab380a1204..ba387d85dcfd 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -546,13 +546,17 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
546 if (!wdev->connect_keys->params[i].cipher) 546 if (!wdev->connect_keys->params[i].cipher)
547 continue; 547 continue;
548 if (rdev->ops->add_key(wdev->wiphy, dev, i, NULL, 548 if (rdev->ops->add_key(wdev->wiphy, dev, i, NULL,
549 &wdev->connect_keys->params[i])) 549 &wdev->connect_keys->params[i])) {
550 printk(KERN_ERR "%s: failed to set key %d\n", 550 printk(KERN_ERR "%s: failed to set key %d\n",
551 dev->name, i); 551 dev->name, i);
552 continue;
553 }
552 if (wdev->connect_keys->def == i) 554 if (wdev->connect_keys->def == i)
553 if (rdev->ops->set_default_key(wdev->wiphy, dev, i)) 555 if (rdev->ops->set_default_key(wdev->wiphy, dev, i)) {
554 printk(KERN_ERR "%s: failed to set defkey %d\n", 556 printk(KERN_ERR "%s: failed to set defkey %d\n",
555 dev->name, i); 557 dev->name, i);
558 continue;
559 }
556 if (wdev->connect_keys->defmgmt == i) 560 if (wdev->connect_keys->defmgmt == i)
557 if (rdev->ops->set_default_mgmt_key(wdev->wiphy, dev, i)) 561 if (rdev->ops->set_default_mgmt_key(wdev->wiphy, dev, i))
558 printk(KERN_ERR "%s: failed to set mgtdef %d\n", 562 printk(KERN_ERR "%s: failed to set mgtdef %d\n",