kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data()
@ 2021-08-31  8:18 Dan Carpenter
  2021-08-31  8:18 ` [PATCH 2/2] iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys() Dan Carpenter
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Dan Carpenter @ 2021-08-31  8:18 UTC (permalink / raw)
  To: Luca Coelho, Johannes Berg
  Cc: Kalle Valo, Emmanuel Grumbach, Mordechay Goodstein, Sara Sharon,
	Naftali Goldstein, Dan Halperin, linux-wireless, kernel-janitors

These should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() to prevent an
out of bounds write on the next line.

Fixes: 79e561f0f05a ("iwlwifi: mvm: d3: implement RSC command version 5")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index 0e97d5e6c644..6e3a63a5a75c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -360,11 +360,11 @@ static void iwl_mvm_wowlan_get_rsc_v5_data(struct ieee80211_hw *hw,
 	if (sta) {
 		rsc = data->rsc->ucast_rsc;
 	} else {
-		if (WARN_ON(data->gtks > ARRAY_SIZE(data->gtk_ids)))
+		if (WARN_ON(data->gtks >= ARRAY_SIZE(data->gtk_ids)))
 			return;
 		data->gtk_ids[data->gtks] = key->keyidx;
 		rsc = data->rsc->mcast_rsc[data->gtks % 2];
-		if (WARN_ON(key->keyidx >
+		if (WARN_ON(key->keyidx >=
 				ARRAY_SIZE(data->rsc->mcast_key_id_map)))
 			return;
 		data->rsc->mcast_key_id_map[key->keyidx] = data->gtks % 2;
-- 
2.20.1


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

* [PATCH 2/2] iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys()
  2021-08-31  8:18 [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Dan Carpenter
@ 2021-08-31  8:18 ` Dan Carpenter
  2021-09-17  6:24   ` Coelho, Luciano
  2021-09-16 17:05 ` [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Kalle Valo
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2021-08-31  8:18 UTC (permalink / raw)
  To: Luca Coelho, Johannes Berg
  Cc: Kalle Valo, Emmanuel Grumbach, Sara Sharon, Mordechay Goodstein,
	Nathan Errera, Dan Halperin, Naftali Goldstein, linux-wireless,
	kernel-janitors

This code was refactored and the mutex_unlock(&mvm->mutex); was
accidentally deleted.

Fixes: af3aab9ce298 ("iwlwifi: mvm: d3: make key reprogramming iteration optional")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index 6e3a63a5a75c..9f706fffb592 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -160,6 +160,7 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
 		mvm->ptk_icvlen = key->icv_len;
 		mvm->gtk_ivlen = key->iv_len;
 		mvm->gtk_icvlen = key->icv_len;
+		mutex_unlock(&mvm->mutex);
 
 		/* don't upload key again */
 		return;
-- 
2.20.1


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

* Re: [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data()
  2021-08-31  8:18 [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Dan Carpenter
  2021-08-31  8:18 ` [PATCH 2/2] iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys() Dan Carpenter
@ 2021-09-16 17:05 ` Kalle Valo
  2021-09-17  6:25   ` Coelho, Luciano
  2021-09-17  6:23 ` Coelho, Luciano
  2021-09-19 14:34 ` Kalle Valo
  3 siblings, 1 reply; 7+ messages in thread
From: Kalle Valo @ 2021-09-16 17:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Luca Coelho, Johannes Berg, Emmanuel Grumbach,
	Mordechay Goodstein, Sara Sharon, Naftali Goldstein,
	Dan Halperin, linux-wireless, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> writes:

> These should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() to prevent an
> out of bounds write on the next line.
>
> Fixes: 79e561f0f05a ("iwlwifi: mvm: d3: implement RSC command version 5")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

I think I should take both patches to v5.15. Luca, do you agree? Ack?

I assigned these to me on patchwork.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data()
  2021-08-31  8:18 [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Dan Carpenter
  2021-08-31  8:18 ` [PATCH 2/2] iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys() Dan Carpenter
  2021-09-16 17:05 ` [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Kalle Valo
@ 2021-09-17  6:23 ` Coelho, Luciano
  2021-09-19 14:34 ` Kalle Valo
  3 siblings, 0 replies; 7+ messages in thread
From: Coelho, Luciano @ 2021-09-17  6:23 UTC (permalink / raw)
  To: dan.carpenter, Berg, Johannes
  Cc: kernel-janitors, Goldstein, Naftali, kvalo, linux-wireless,
	Goodstein, Mordechay, Sharon, Sara, Grumbach, Emmanuel,
	Dan1.Halperin

On Tue, 2021-08-31 at 11:18 +0300, Dan Carpenter wrote:
> These should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() to prevent an
> out of bounds write on the next line.
> 
> Fixes: 79e561f0f05a ("iwlwifi: mvm: d3: implement RSC command version 5")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> index 0e97d5e6c644..6e3a63a5a75c 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> @@ -360,11 +360,11 @@ static void iwl_mvm_wowlan_get_rsc_v5_data(struct ieee80211_hw *hw,
>  	if (sta) {
>  		rsc = data->rsc->ucast_rsc;
>  	} else {
> -		if (WARN_ON(data->gtks > ARRAY_SIZE(data->gtk_ids)))
> +		if (WARN_ON(data->gtks >= ARRAY_SIZE(data->gtk_ids)))
>  			return;
>  		data->gtk_ids[data->gtks] = key->keyidx;
>  		rsc = data->rsc->mcast_rsc[data->gtks % 2];
> -		if (WARN_ON(key->keyidx >
> +		if (WARN_ON(key->keyidx >=
>  				ARRAY_SIZE(data->rsc->mcast_key_id_map)))
>  			return;
>  		data->rsc->mcast_key_id_map[key->keyidx] = data->gtks % 2;

Thanks!

Acked-by: Luca Coelho <luca@coelho.fi>

--
Cheers,
Luca.

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

* Re: [PATCH 2/2] iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys()
  2021-08-31  8:18 ` [PATCH 2/2] iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys() Dan Carpenter
@ 2021-09-17  6:24   ` Coelho, Luciano
  0 siblings, 0 replies; 7+ messages in thread
From: Coelho, Luciano @ 2021-09-17  6:24 UTC (permalink / raw)
  To: dan.carpenter, Berg, Johannes
  Cc: Goldstein, Naftali, kernel-janitors, kvalo, Errera, Nathan,
	Goodstein, Mordechay, linux-wireless, Sharon, Sara, Grumbach,
	Emmanuel, Dan1.Halperin

On Tue, 2021-08-31 at 11:18 +0300, Dan Carpenter wrote:
> This code was refactored and the mutex_unlock(&mvm->mutex); was
> accidentally deleted.
> 
> Fixes: af3aab9ce298 ("iwlwifi: mvm: d3: make key reprogramming iteration optional")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> index 6e3a63a5a75c..9f706fffb592 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
> @@ -160,6 +160,7 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
>  		mvm->ptk_icvlen = key->icv_len;
>  		mvm->gtk_ivlen = key->iv_len;
>  		mvm->gtk_icvlen = key->icv_len;
> +		mutex_unlock(&mvm->mutex);
>  
> 
>  		/* don't upload key again */
>  		return;

Thank you, Dan!

Acked-by: Luca Coelho <luca@coelho.fi>

--
Cheers,
Luca.

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

* Re: [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data()
  2021-09-16 17:05 ` [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Kalle Valo
@ 2021-09-17  6:25   ` Coelho, Luciano
  0 siblings, 0 replies; 7+ messages in thread
From: Coelho, Luciano @ 2021-09-17  6:25 UTC (permalink / raw)
  To: dan.carpenter, kvalo
  Cc: kernel-janitors, Goldstein, Naftali, Berg, Johannes,
	linux-wireless, Goodstein, Mordechay, Sharon, Sara, Grumbach,
	Emmanuel, Dan1.Halperin

On Thu, 2021-09-16 at 20:05 +0300, Kalle Valo wrote:
> Dan Carpenter <dan.carpenter@oracle.com> writes:
> 
> > These should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() to prevent an
> > out of bounds write on the next line.
> > 
> > Fixes: 79e561f0f05a ("iwlwifi: mvm: d3: implement RSC command version 5")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> I think I should take both patches to v5.15. Luca, do you agree? Ack?
> 
> I assigned these to me on patchwork.

Yes, please take them, thanks!

--
Cheers,
Luca.

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

* Re: [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data()
  2021-08-31  8:18 [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Dan Carpenter
                   ` (2 preceding siblings ...)
  2021-09-17  6:23 ` Coelho, Luciano
@ 2021-09-19 14:34 ` Kalle Valo
  3 siblings, 0 replies; 7+ messages in thread
From: Kalle Valo @ 2021-09-19 14:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Luca Coelho, Johannes Berg, Emmanuel Grumbach,
	Mordechay Goodstein, Sara Sharon, Naftali Goldstein,
	Dan Halperin, linux-wireless, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:

> These should be >= ARRAY_SIZE() instead of > ARRAY_SIZE() to prevent an
> out of bounds write on the next line.
> 
> Fixes: 79e561f0f05a ("iwlwifi: mvm: d3: implement RSC command version 5")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Luca Coelho <luca@coelho.fi>

2 patches applied to wireless-drivers.git, thanks.

27a221f433b7 iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data()
b6a46b4f6e4b iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210831081802.GA9846@kili/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2021-09-19 14:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31  8:18 [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Dan Carpenter
2021-08-31  8:18 ` [PATCH 2/2] iwlwifi: mvm: d3: missing unlock in iwl_mvm_wowlan_program_keys() Dan Carpenter
2021-09-17  6:24   ` Coelho, Luciano
2021-09-16 17:05 ` [PATCH 1/2] iwlwifi: mvm: d3: Fix off by ones in iwl_mvm_wowlan_get_rsc_v5_data() Kalle Valo
2021-09-17  6:25   ` Coelho, Luciano
2021-09-17  6:23 ` Coelho, Luciano
2021-09-19 14:34 ` Kalle Valo

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