[PATCH v2 1/3] nl80211: back to default bitrate_mask correctly

Janusz Dziedzic
2013-12-05T09:02:29Z

In case of empty NL80211_ATTR_TX_RATES attribute
in nl80211_set_tx_bitrate_mask() function back to
default bitrate mask, to be able to reset the
state.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
net/wireless/nl80211.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c6401a8..072b60d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7311,9 +7311,6 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
struct nlattr *tx_rates;
struct ieee80211_supported_band *sband;

- if (info->attrs[NL80211_ATTR_TX_RATES] == NULL)
- return -EINVAL;
-
if (!rdev->ops->set_bitrate_mask)
return -EOPNOTSUPP;

@@ -7331,6 +7328,10 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
sizeof(mask.control[i].mcs));
}

+ /* Back to default settings */
+ if (info->attrs[NL80211_ATTR_TX_RATES] == NULL)
+ goto out;
+
/*
* The nested attribute uses enum nl80211_band as the index. This maps
* directly to the enum ieee80211_band values used in cfg80211.
@@ -7380,6 +7381,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
}
}

+out:
return rdev_set_bitrate_mask(rdev, dev, NULL, &mask);
}

--
1.7.9.5