linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC 2/3] cfg80211: Disallow moving out of operating DFS channel in non-ETSI
Date: Thu, 26 Jan 2017 10:36:46 +0100	[thread overview]
Message-ID: <1485423406.11038.6.camel@sipsolutions.net> (raw)
In-Reply-To: <1485343870-23601-3-git-send-email-vthiagar@qti.qualcomm.com>


> +static bool cfg80211_off_channel_oper_allowed(struct wireless_dev
> *wdev)
> +{
> +	if (!cfg80211_beaconing_iface_active(wdev))
> +		return true;
> +
> +	if (!(wdev->chandef.chan->flags & IEEE80211_CHAN_RADAR))
> +		return true;

That could use some locking assertions. Maybe also in the
cfg80211_beaconing_iface_active() function you introduced in the
previous patch.

> +	if (!cfg80211_off_channel_oper_allowed(wdev)) {
> +		struct ieee80211_channel *chan;
> +
> +		if (request->n_channels != 1) {
> +			err = -EBUSY;
> +			goto out_free;
> +		}
> +
> +		chan = request->channels[0];
> +		if (chan->center_freq != wdev->chandef.chan-
> >center_freq) {
> +			err = -EBUSY;
> +			goto out_free;
> +		}
> +	}

I'm not convinced you even hold the relevant locks here, though off the
top of my head I'm not even sure which are needed.

>  	i = 0;
>  	if (n_ssids) {
>  		nla_for_each_nested(attr, info-
> >attrs[NL80211_ATTR_SCAN_SSIDS], tmp) {
> @@ -9053,6 +9079,7 @@ static int nl80211_remain_on_channel(struct
> sk_buff *skb,
>  	struct cfg80211_registered_device *rdev = info->user_ptr[0];
>  	struct wireless_dev *wdev = info->user_ptr[1];
>  	struct cfg80211_chan_def chandef;
> +	const struct cfg80211_chan_def *compat_chandef;
>  	struct sk_buff *msg;
>  	void *hdr;
>  	u64 cookie;
> @@ -9081,6 +9108,14 @@ static int nl80211_remain_on_channel(struct
> sk_buff *skb,
>  	if (err)
>  		return err;
>  
> +	if (!(cfg80211_off_channel_oper_allowed(wdev) ||
> +	      cfg80211_chandef_identical(&wdev->chandef, &chandef)))

I'd prefer to write that as !off_channel && !chandef_identical, seems
easier to understand here.

johannes

  parent reply	other threads:[~2017-01-26  9:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-25 11:31 [RFC 0/3] Pre-CAC and sharing DFS state across multiple radios Vasanthakumar Thiagarajan
2017-01-25 11:31 ` [RFC 1/3] cfg80211: Make pre-CAC results valid only for ETSI domain Vasanthakumar Thiagarajan
2017-01-26  9:34   ` Johannes Berg
2017-01-31  9:10     ` Thiagarajan, Vasanthakumar
2017-01-25 11:31 ` [RFC 2/3] cfg80211: Disallow moving out of operating DFS channel in non-ETSI Vasanthakumar Thiagarajan
2017-01-25 18:20   ` Jean-Pierre Tosoni
2017-01-31  8:40     ` Thiagarajan, Vasanthakumar
2017-01-26  9:36   ` Johannes Berg [this message]
2017-01-31  9:12     ` Thiagarajan, Vasanthakumar
2017-01-25 11:31 ` [RFC 3/3] cfg80211: Share Channel DFS state across wiphys of same DFS domain Vasanthakumar Thiagarajan
2017-01-26  9:41   ` Johannes Berg
2017-01-31  9:18     ` Thiagarajan, Vasanthakumar

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=1485423406.11038.6.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=vthiagar@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).