From: Felix Fietkau <nbd@openwrt.org>
To: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
johannes@sipsolutions.net, arend@broadcom.com
Subject: Re: [PATCH v2 3.7 2/2] cfg80211: fix initialization of chan->max_reg_power
Date: Mon, 08 Oct 2012 23:01:30 +0200 [thread overview]
Message-ID: <50733F2A.2060306@openwrt.org> (raw)
In-Reply-To: <20121008190156.GK3354@lenteja.do-not-panic.com>
On 2012-10-08 9:01 PM, Luis R. Rodriguez wrote:
> On Sat, Oct 06, 2012 at 02:40:54PM +0200, Felix Fietkau wrote:
>> A few places touch chan->max_power based on updated tx power rules, but
>> forget to do the same to chan->max_reg_power.
>>
>> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
>> Cc: stable@vger.kernel.org
>> ---
>> net/wireless/reg.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
>> index 3b8cbbc..bcc7d7e 100644
>> --- a/net/wireless/reg.c
>> +++ b/net/wireless/reg.c
>> @@ -908,7 +908,7 @@ static void handle_channel(struct wiphy *wiphy,
>> map_regdom_flags(reg_rule->flags) | bw_flags;
>> chan->max_antenna_gain = chan->orig_mag =
>> (int) MBI_TO_DBI(power_rule->max_antenna_gain);
>> - chan->max_power = chan->orig_mpwr =
>> + chan->max_reg_power = chan->max_power = chan->orig_mpwr =
>> (int) MBM_TO_DBM(power_rule->max_eirp);
>> return;
>> }
>> @@ -1331,7 +1331,8 @@ static void handle_channel_custom(struct wiphy *wiphy,
>>
>> chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
>> chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
>> - chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
>> + chan->max_reg_power = chan->max_power =
>> + (int) MBM_TO_DBM(power_rule->max_eirp);
>
> This looks good to me, good catch! The commit log could use some love,
> given that this is a stable patch it is worthy to describe the
> consequences of not applying this patch. Can you describe what you
> observed that makes this a critical patch? The only piece of code
> that uses max_reg_power in cfg80211, mac80211 or drivers is on
> net/wireless/reg.c and drivers/net/wireless/mwifiex/cfg80211.c.
> In either case the issue the code you are patching is for code
> that deals with drivers that have a custom regulatory domain
> in which orig_mpwr would have been initialized to a non-zero value
> upon registration. In such cases we could only potenially run into
> an issue on this piece of code on handle_channel():
>
> chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
> if (chan->orig_mpwr) {
> /*
> * Devices that have their own custom regulatory domain
> * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the
> * passed country IE power settings.
> */
> if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
> wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY &&
> wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
> chan->max_power = chan->max_reg_power;
> else
> chan->max_power = min(chan->orig_mpwr,
> chan->max_reg_power);
> } else
> chan->max_power = chan->max_reg_power;
>
> The issue would happen if orig_mpwr is non zero (custom) and
> then max_reg_power would not have been initialized. This runs
> when you change a regulatory domain on a card with a custom
> regulatory domain and this would be an issue if max_reg_power
> would not be initialized. This however does not happen due to
> the first line above.
>
> So I agree with this patch but do not see the requirement for
> it to go in as a stable fix to older stable kernels.
OK, I'll extend the commit log and resend without the stable-Cc.
- Felix
next prev parent reply other threads:[~2012-10-08 21:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-06 12:40 [PATCH v2 3.7 1/2] cfg80211: fix antenna gain handling Felix Fietkau
2012-10-06 12:40 ` [PATCH v2 3.7 2/2] cfg80211: fix initialization of chan->max_reg_power Felix Fietkau
2012-10-08 19:01 ` Luis R. Rodriguez
2012-10-08 21:01 ` Felix Fietkau [this message]
2012-10-09 0:12 ` Luis R. Rodriguez
2012-10-08 18:37 ` [PATCH v2 3.7 1/2] cfg80211: fix antenna gain handling Luis R. Rodriguez
2012-10-08 20:52 ` Felix Fietkau
2012-10-09 1:00 ` Luis R. Rodriguez
2012-10-09 9:49 ` Felix Fietkau
2012-10-09 18:43 ` Luis R. Rodriguez
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=50733F2A.2060306@openwrt.org \
--to=nbd@openwrt.org \
--cc=arend@broadcom.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=rodrigue@qca.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