linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jouni Malinen <jouni@qca.qualcomm.com>
Cc: linux-wireless@vger.kernel.org, vamsi krishna <vamsin@qti.qualcomm.com>
Subject: Re: [PATCH] cfg80211: Add support to update connection parameters
Date: Fri, 14 Oct 2016 09:32:05 +0200	[thread overview]
Message-ID: <1476430325.4382.18.camel@sipsolutions.net> (raw)
In-Reply-To: <1476373178-31105-1-git-send-email-jouni@qca.qualcomm.com>

In addition to Arend's comments...

>   *     (invoked with the wireless_dev mutex held)
> + * @update_connect_params: Update the connect parameters while connected to a
> + *     BSS. The updated parameters can be used by driver/firmware for
> + *     subsequent BSS selection (roaming) decisions and to form the
> + *     Authentication/(Re)Association Request frames. This call does not
> + *     request an immediate disassociation or reassociation with the current
> + *     BSS, i.e., this impacts only subsequence (re)associations.

The other related calls are all invoked with the wireless_dev mutex
held, I think it'd be better for consistency to replicate that here.

> +static int nl80211_update_connect_params(struct sk_buff *skb,
> +					 struct genl_info *info)
> +{
> +	struct cfg80211_connect_params connect;
> +	struct cfg80211_connect_params_valid cpv;
> +	struct cfg80211_registered_device *rdev = info->user_ptr[0];
> +	struct net_device *dev = info->user_ptr[1];
> +	struct wireless_dev *wdev = dev->ieee80211_ptr;
> +
> +	memset(&connect, 0, sizeof(connect));
> +	memset(&cpv, 0, sizeof(cpv));

I tend to prefer (0) C99 initalizers since it makes the code shorter,
but it doesn't really matter much.

> +	if (!wdev->current_bss)
> +		return -ENOLINK;

Also, regarding the locking, there's no guarantee that this won't
become NULL immediately after the check, if you don't have any locking.

Now, the driver (or more likely firmware!), would still have to protect
against races, say where the firmware disconnected while userspace
called this ... but at least software wise it'd be consistent.

johannes

      parent reply	other threads:[~2016-10-14  7:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13 15:39 [PATCH] cfg80211: Add support to update connection parameters Jouni Malinen
2016-10-13 18:58 ` Arend van Spriel
2016-10-14  7:27   ` Johannes Berg
2016-10-14  7:32 ` Johannes Berg [this message]

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=1476430325.4382.18.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=jouni@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=vamsin@qti.qualcomm.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;
as well as URLs for NNTP newsgroup(s).