stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: fix a potential infinite loop
@ 2022-05-17  9:58 Yuanjun Gong
  2022-05-17 10:06 ` Greg KH
  2022-05-17 10:06 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Yuanjun Gong @ 2022-05-17  9:58 UTC (permalink / raw)
  To: Yuanjun Gong, Larry Finger, linux-kernel; +Cc: stable

From: Gong Yuanjun <ruc_gongyuanjun@163.com>

In the for-loop in _rtl92e_update_rxcounts(),
i is a u8 counter while priv->rtllib->LinkDetectInfo.SlotNum is
a u16 num, there is a potential infinite loop if SlotNum is larger
than u8_max.

Change the u8 loop counter i into u16.

Signed-off-by: Gong Yuanjun <ruc_gongyuanjun@163.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index b9ce71848023..3c5082abc583 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1342,7 +1342,7 @@ static void _rtl92e_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum,
 				    u32 *TotalRxDataNum)
 {
 	u16	SlotIndex;
-	u8	i;
+	u16	i;
 
 	*TotalRxBcnNum = 0;
 	*TotalRxDataNum = 0;
-- 
2.17.1


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

* Re: [PATCH 1/1] staging: fix a potential infinite loop
  2022-05-17  9:58 [PATCH 1/1] staging: fix a potential infinite loop Yuanjun Gong
@ 2022-05-17 10:06 ` Greg KH
  2022-05-17 10:06 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-05-17 10:06 UTC (permalink / raw)
  To: Yuanjun Gong; +Cc: Larry Finger, linux-kernel, stable

On Tue, May 17, 2022 at 05:58:09PM +0800, Yuanjun Gong wrote:
> From: Gong Yuanjun <ruc_gongyuanjun@163.com>
> 
> In the for-loop in _rtl92e_update_rxcounts(),
> i is a u8 counter while priv->rtllib->LinkDetectInfo.SlotNum is
> a u16 num, there is a potential infinite loop if SlotNum is larger
> than u8_max.

can SlotNum ever get larger than that?  If not, then why not just change
that type instead?

And you forgot to list the driver name in the subject line and cc: all
the right people that scripts/get_maintainer.pl will tell you to cc:

Please fix that up and resend a v2.

thanks,

greg k-h

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

* Re: [PATCH 1/1] staging: fix a potential infinite loop
  2022-05-17  9:58 [PATCH 1/1] staging: fix a potential infinite loop Yuanjun Gong
  2022-05-17 10:06 ` Greg KH
@ 2022-05-17 10:06 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-05-17 10:06 UTC (permalink / raw)
  To: Yuanjun Gong; +Cc: Larry Finger, linux-kernel, stable

On Tue, May 17, 2022 at 05:58:09PM +0800, Yuanjun Gong wrote:
> From: Gong Yuanjun <ruc_gongyuanjun@163.com>
> 
> In the for-loop in _rtl92e_update_rxcounts(),
> i is a u8 counter while priv->rtllib->LinkDetectInfo.SlotNum is
> a u16 num, there is a potential infinite loop if SlotNum is larger
> than u8_max.
> 
> Change the u8 loop counter i into u16.
> 
> Signed-off-by: Gong Yuanjun <ruc_gongyuanjun@163.com>
> ---
>  drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index b9ce71848023..3c5082abc583 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> @@ -1342,7 +1342,7 @@ static void _rtl92e_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum,
>  				    u32 *TotalRxDataNum)
>  {
>  	u16	SlotIndex;
> -	u8	i;
> +	u16	i;
>  
>  	*TotalRxBcnNum = 0;
>  	*TotalRxDataNum = 0;
> -- 
> 2.17.1
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

end of thread, other threads:[~2022-05-17 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17  9:58 [PATCH 1/1] staging: fix a potential infinite loop Yuanjun Gong
2022-05-17 10:06 ` Greg KH
2022-05-17 10:06 ` Greg KH

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