2014-05-15 10:05:57

by Luca Coelho

[permalink] [raw]
Subject: [PATCH] cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()

From: Luciano Coelho <[email protected]>

There is no need to pass NL80211_IFTYPE_UNSPECIFIED when calling
cfg80211_chandef_dfs_required() since we always already have the
interface type. So, pass the actual interface type instead.

Additionally, have cfg80211_chandef_dfs_required() WARN if the passed
interface type is NL80211_IFTYPE_UNSPECIFIED, so we can detect
problems more easily.

Cc: Janusz Dziedzic <[email protected]>
Reported-by: Eliad Peller <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
net/wireless/chan.c | 5 ++---
net/wireless/nl80211.c | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 7a679a6..992b340 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -340,7 +340,6 @@ int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
case NL80211_IFTYPE_MESH_POINT:
- case NL80211_IFTYPE_UNSPECIFIED:
width = cfg80211_chandef_get_width(chandef);
if (width < 0)
return -EINVAL;
@@ -372,6 +371,7 @@ int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
case NL80211_IFTYPE_WDS:
case NL80211_IFTYPE_P2P_DEVICE:
break;
+ case NL80211_IFTYPE_UNSPECIFIED:
case NUM_NL80211_IFTYPES:
WARN_ON(1);
}
@@ -796,8 +796,7 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
!cfg80211_go_permissive_chan(rdev, chandef->chan))
prohibited_flags |= IEEE80211_CHAN_NO_IR;

- if (cfg80211_chandef_dfs_required(wiphy, chandef,
- NL80211_IFTYPE_UNSPECIFIED) > 0 &&
+ if (cfg80211_chandef_dfs_required(wiphy, chandef, iftype) > 0 &&
cfg80211_chandef_dfs_available(wiphy, chandef)) {
/* We can skip IEEE80211_CHAN_NO_IR if chandef dfs available */
prohibited_flags = IEEE80211_CHAN_DISABLED;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c083383..74e7299 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5822,7 +5822,7 @@ static int nl80211_start_radar_detection(struct sk_buff *skb,
return -EBUSY;

err = cfg80211_chandef_dfs_required(wdev->wiphy, &chandef,
- NL80211_IFTYPE_UNSPECIFIED);
+ wdev->iftype);
if (err < 0)
return err;

--
2.0.0.rc0



2014-05-15 11:37:18

by Janusz Dziedzic

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()

On 15 May 2014 12:05, Luca Coelho <[email protected]> wrote:
> From: Luciano Coelho <[email protected]>
>
> There is no need to pass NL80211_IFTYPE_UNSPECIFIED when calling
> cfg80211_chandef_dfs_required() since we always already have the
> interface type. So, pass the actual interface type instead.
>
> Additionally, have cfg80211_chandef_dfs_required() WARN if the passed
> interface type is NL80211_IFTYPE_UNSPECIFIED, so we can detect
> problems more easily.
>
> Cc: Janusz Dziedzic <[email protected]>
> Reported-by: Eliad Peller <[email protected]>
> Signed-off-by: Luciano Coelho <[email protected]>

Tested-by: Janusz Dziedzic <[email protected]>

Thanks, works fine.

BR
Janusz

2014-05-15 12:51:22

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: pass the actual iftype when calling cfg80211_chandef_dfs_required()

On Thu, 2014-05-15 at 13:05 +0300, Luca Coelho wrote:
> From: Luciano Coelho <[email protected]>
>
> There is no need to pass NL80211_IFTYPE_UNSPECIFIED when calling
> cfg80211_chandef_dfs_required() since we always already have the
> interface type. So, pass the actual interface type instead.
>
> Additionally, have cfg80211_chandef_dfs_required() WARN if the passed
> interface type is NL80211_IFTYPE_UNSPECIFIED, so we can detect
> problems more easily.

Applied, thanks.

johannes