linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath6kl: protect firmware from excessive WoW pattern length
@ 2012-08-16  0:15 Thomas Pedersen
  2012-08-20  7:09 ` Kalle Valo
  2012-08-20  7:13 ` Johannes Berg
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Pedersen @ 2012-08-16  0:15 UTC (permalink / raw)
  To: kvalo; +Cc: ath6kl-devel, linux-wireless, Thomas Pedersen

Don't accept WoW patterns longer than supported by firmware.

Reported-by: Haijun Jin <nhjin@qca.qualcomm.com>
Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index bd003fe..ffa18f3 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1876,6 +1876,9 @@ static int ath6kl_wow_usr(struct ath6kl *ar, struct ath6kl_vif *vif,
 	/* Configure the patterns that we received from the user. */
 	for (i = 0; i < wow->n_patterns; i++) {
 
+		if (wow->patterns[i].pattern_len > WOW_MASK_SIZE)
+			return -EINVAL;
+
 		/*
 		 * Convert given nl80211 specific mask value to equivalent
 		 * driver specific mask value and send it to the chip along
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ath6kl: protect firmware from excessive WoW pattern length
  2012-08-16  0:15 [PATCH] ath6kl: protect firmware from excessive WoW pattern length Thomas Pedersen
@ 2012-08-20  7:09 ` Kalle Valo
  2012-08-20  7:13 ` Johannes Berg
  1 sibling, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2012-08-20  7:09 UTC (permalink / raw)
  To: Thomas Pedersen; +Cc: ath6kl-devel, linux-wireless

On 08/16/2012 03:15 AM, Thomas Pedersen wrote:
> Don't accept WoW patterns longer than supported by firmware.
> 
> Reported-by: Haijun Jin <nhjin@qca.qualcomm.com>
> Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>

Thanks, applied.

Kalle

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ath6kl: protect firmware from excessive WoW pattern length
  2012-08-16  0:15 [PATCH] ath6kl: protect firmware from excessive WoW pattern length Thomas Pedersen
  2012-08-20  7:09 ` Kalle Valo
@ 2012-08-20  7:13 ` Johannes Berg
  2012-08-20  7:29   ` Kalle Valo
  1 sibling, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2012-08-20  7:13 UTC (permalink / raw)
  To: Thomas Pedersen; +Cc: kvalo, ath6kl-devel, linux-wireless

On Wed, 2012-08-15 at 17:15 -0700, Thomas Pedersen wrote:
> Don't accept WoW patterns longer than supported by firmware.
> 
> Reported-by: Haijun Jin <nhjin@qca.qualcomm.com>
> Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath6kl/cfg80211.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> index bd003fe..ffa18f3 100644
> --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
> +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> @@ -1876,6 +1876,9 @@ static int ath6kl_wow_usr(struct ath6kl *ar, struct ath6kl_vif *vif,
>  	/* Configure the patterns that we received from the user. */
>  	for (i = 0; i < wow->n_patterns; i++) {
>  
> +		if (wow->patterns[i].pattern_len > WOW_MASK_SIZE)
> +			return -EINVAL;
> +

No objection, but doesn't nl80211 already validate that (assuming you
give the right pattern_max_len, of course)?

johannes


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ath6kl: protect firmware from excessive WoW pattern length
  2012-08-20  7:13 ` Johannes Berg
@ 2012-08-20  7:29   ` Kalle Valo
  2012-08-20 18:18     ` Pedersen, Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2012-08-20  7:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Thomas Pedersen, ath6kl-devel, linux-wireless

On 08/20/2012 10:13 AM, Johannes Berg wrote:
> On Wed, 2012-08-15 at 17:15 -0700, Thomas Pedersen wrote:
>> Don't accept WoW patterns longer than supported by firmware.
>>
>> Reported-by: Haijun Jin <nhjin@qca.qualcomm.com>
>> Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
>> ---
>>  drivers/net/wireless/ath/ath6kl/cfg80211.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
>> index bd003fe..ffa18f3 100644
>> --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
>> +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
>> @@ -1876,6 +1876,9 @@ static int ath6kl_wow_usr(struct ath6kl *ar, struct ath6kl_vif *vif,
>>  	/* Configure the patterns that we received from the user. */
>>  	for (i = 0; i < wow->n_patterns; i++) {
>>  
>> +		if (wow->patterns[i].pattern_len > WOW_MASK_SIZE)
>> +			return -EINVAL;
>> +
> 
> No objection, but doesn't nl80211 already validate that (assuming you
> give the right pattern_max_len, of course)?

And ath6kl even uses different define pattern_max_len:

	wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;

But the value is still same:

#define WOW_PATTERN_SIZE	 64
#define WOW_MASK_SIZE		 64

Thomas, can you please check this? Do we really need two different
defines? And which one is the correct one here?

I'll keep the patch applied but I'm happy to take followup patches to
clarify this part.

Kalle

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ath6kl: protect firmware from excessive WoW pattern length
  2012-08-20  7:29   ` Kalle Valo
@ 2012-08-20 18:18     ` Pedersen, Thomas
  2012-08-20 19:08       ` Kalle Valo
  0 siblings, 1 reply; 7+ messages in thread
From: Pedersen, Thomas @ 2012-08-20 18:18 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Johannes Berg, ath6kl-devel, linux-wireless

On Mon, Aug 20, 2012 at 10:29:19AM +0300, Kalle Valo wrote:
> On 08/20/2012 10:13 AM, Johannes Berg wrote:
> > On Wed, 2012-08-15 at 17:15 -0700, Thomas Pedersen wrote:
> >> Don't accept WoW patterns longer than supported by firmware.
> >>
> >> Reported-by: Haijun Jin <nhjin@qca.qualcomm.com>
> >> Signed-off-by: Thomas Pedersen <c_tpeder@qca.qualcomm.com>
> >> ---
> >>  drivers/net/wireless/ath/ath6kl/cfg80211.c |    3 +++
> >>  1 files changed, 3 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> >> index bd003fe..ffa18f3 100644
> >> --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
> >> +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
> >> @@ -1876,6 +1876,9 @@ static int ath6kl_wow_usr(struct ath6kl *ar, struct ath6kl_vif *vif,
> >>  	/* Configure the patterns that we received from the user. */
> >>  	for (i = 0; i < wow->n_patterns; i++) {
> >>  
> >> +		if (wow->patterns[i].pattern_len > WOW_MASK_SIZE)
> >> +			return -EINVAL;
> >> +
> > 
> > No objection, but doesn't nl80211 already validate that (assuming you
> > give the right pattern_max_len, of course)?

Thanks for pointing that out. That check would be completely redundant
then.

Kalle,

Can you revert this patch? Otherwise the followup will just do the same.

> And ath6kl even uses different define pattern_max_len:
> 
> 	wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
> 
> But the value is still same:
> 
> #define WOW_PATTERN_SIZE	 64
> #define WOW_MASK_SIZE		 64
> 
> Thomas, can you please check this? Do we really need two different
> defines? And which one is the correct one here?

No AFAICT there is no reason to have two different defines. I can submit
a small patch consolidating these, but it would remove the above hunk
anyway so I need to know whether you'll revert or not.

Thanks,
Thomas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ath6kl: protect firmware from excessive WoW pattern length
  2012-08-20 18:18     ` Pedersen, Thomas
@ 2012-08-20 19:08       ` Kalle Valo
  2012-08-20 20:33         ` Pedersen, Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2012-08-20 19:08 UTC (permalink / raw)
  To: Pedersen, Thomas; +Cc: Johannes Berg, ath6kl-devel, linux-wireless

On 08/20/2012 09:18 PM, Pedersen, Thomas wrote:
> On Mon, Aug 20, 2012 at 10:29:19AM +0300, Kalle Valo wrote:
>> On 08/20/2012 10:13 AM, Johannes Berg wrote:
>>
>>> No objection, but doesn't nl80211 already validate that (assuming you
>>> give the right pattern_max_len, of course)?
> 
> Thanks for pointing that out. That check would be completely redundant
> then.
> 
> Kalle,
> 
> Can you revert this patch? Otherwise the followup will just do the same.

I can revert the patch. But IMHO the check isn't that bad, and even
cfg80211 can be buggy sometimes ;)

>> And ath6kl even uses different define pattern_max_len:
>>
>> 	wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
>>
>> But the value is still same:
>>
>> #define WOW_PATTERN_SIZE	 64
>> #define WOW_MASK_SIZE		 64
>>
>> Thomas, can you please check this? Do we really need two different
>> defines? And which one is the correct one here?
> 
> No AFAICT there is no reason to have two different defines. I can submit
> a small patch consolidating these, but it would remove the above hunk
> anyway so I need to know whether you'll revert or not.

Thanks. I'll revert the patch so please prepare your patch without the
check.

Kalle

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ath6kl: protect firmware from excessive WoW pattern length
  2012-08-20 19:08       ` Kalle Valo
@ 2012-08-20 20:33         ` Pedersen, Thomas
  0 siblings, 0 replies; 7+ messages in thread
From: Pedersen, Thomas @ 2012-08-20 20:33 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Johannes Berg, ath6kl-devel, linux-wireless

On Mon, Aug 20, 2012 at 10:08:47PM +0300, Kalle Valo wrote:
> > Can you revert this patch? Otherwise the followup will just do the same.
> 
> I can revert the patch. But IMHO the check isn't that bad, and even
> cfg80211 can be buggy sometimes ;)
> 

Well it's probably better not to cover any cfg80211 bugs up in the
driver anyway.

> >> And ath6kl even uses different define pattern_max_len:
> >>
> >> 	wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
> >>
> >> But the value is still same:
> >>
> >> #define WOW_PATTERN_SIZE	 64
> >> #define WOW_MASK_SIZE		 64
> >>
> >> Thomas, can you please check this? Do we really need two different
> >> defines? And which one is the correct one here?
> > 
> > No AFAICT there is no reason to have two different defines. I can submit
> > a small patch consolidating these, but it would remove the above hunk
> > anyway so I need to know whether you'll revert or not.
> 
> Thanks. I'll revert the patch so please prepare your patch without the
> check.

OK.

Thomas

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-20 20:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16  0:15 [PATCH] ath6kl: protect firmware from excessive WoW pattern length Thomas Pedersen
2012-08-20  7:09 ` Kalle Valo
2012-08-20  7:13 ` Johannes Berg
2012-08-20  7:29   ` Kalle Valo
2012-08-20 18:18     ` Pedersen, Thomas
2012-08-20 19:08       ` Kalle Valo
2012-08-20 20:33         ` Pedersen, Thomas

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).