From: Johannes Berg <johannes@sipsolutions.net>
To: Zhu Yi <yi.zhu@intel.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] cfg80211: avoid setting default_key if add_key fails
Date: Mon, 20 Jul 2009 12:34:26 +0200 [thread overview]
Message-ID: <1248086067.4204.6.camel@johannes.local> (raw)
In-Reply-To: <1248077577-7295-1-git-send-email-yi.zhu@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]
On Mon, 2009-07-20 at 16:12 +0800, Zhu Yi wrote:
> 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.
Should we even disconnect again in that case?
johannes
> Signed-off-by: Zhu Yi <yi.zhu@intel.com>
> ---
> net/wireless/util.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/net/wireless/util.c b/net/wireless/util.c
> index 4bab380..ba387d8 100644
> --- a/net/wireless/util.c
> +++ b/net/wireless/util.c
> @@ -546,13 +546,17 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
> if (!wdev->connect_keys->params[i].cipher)
> continue;
> if (rdev->ops->add_key(wdev->wiphy, dev, i, NULL,
> - &wdev->connect_keys->params[i]))
> + &wdev->connect_keys->params[i])) {
> printk(KERN_ERR "%s: failed to set key %d\n",
> dev->name, i);
> + continue;
> + }
> if (wdev->connect_keys->def == i)
> - if (rdev->ops->set_default_key(wdev->wiphy, dev, i))
> + if (rdev->ops->set_default_key(wdev->wiphy, dev, i)) {
> printk(KERN_ERR "%s: failed to set defkey %d\n",
> dev->name, i);
> + continue;
> + }
> if (wdev->connect_keys->defmgmt == i)
> if (rdev->ops->set_default_mgmt_key(wdev->wiphy, dev, i))
> printk(KERN_ERR "%s: failed to set mgtdef %d\n",
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
next prev parent reply other threads:[~2009-07-20 10:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 8:12 [PATCH] cfg80211: avoid setting default_key if add_key fails Zhu Yi
2009-07-20 10:34 ` Johannes Berg [this message]
2009-07-21 1:47 ` Zhu Yi
2009-07-21 10:43 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1248086067.4204.6.camel@johannes.local \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=yi.zhu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox