netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw
@ 2025-03-11  5:16 Kyungwook Boo
  2025-03-11  9:15 ` Przemek Kitszel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kyungwook Boo @ 2025-03-11  5:16 UTC (permalink / raw)
  To: Loktionov, Aleksandr, Przemek Kitszel, Tony Nguyen
  Cc: intel-wired-lan, netdev

When the device sends a specific input, an integer underflow can occur, leading
to MMIO write access to an invalid page.

Prevent the integer underflow by changing the type of related variables.

Signed-off-by: Kyungwook Boo <bookyungwook@gmail.com>
Link: https://lore.kernel.org/lkml/ffc91764-1142-4ba2-91b6-8c773f6f7095@gmail.com/T/
---
Changes in v2:
- Formatting properly
- Fix variable shadowing
- Link to v1: https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-9304071e4579@gmail.com/
---
 drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index 370b4bddee44..b11c35e307ca 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -817,10 +817,11 @@ int i40e_pf_reset(struct i40e_hw *hw)
 void i40e_clear_hw(struct i40e_hw *hw)
 {
 	u32 num_queues, base_queue;
-	u32 num_pf_int;
-	u32 num_vf_int;
+	s32 num_pf_int;
+	s32 num_vf_int;
 	u32 num_vfs;
-	u32 i, j;
+	s32 i;
+	u32 j;
 	u32 val;
 	u32 eol = 0x7ff;
 
---
base-commit: 4d872d51bc9d7b899c1f61534e3dbde72613f627

Best regards,
Kyungwook Boo

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

* Re: [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw
  2025-03-11  5:16 [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw Kyungwook Boo
@ 2025-03-11  9:15 ` Przemek Kitszel
  2025-03-12 13:22   ` Loktionov, Aleksandr
  2025-03-11 11:04 ` Simon Horman
  2025-03-21  4:46 ` [Intel-wired-lan] " Rinitha, SX
  2 siblings, 1 reply; 6+ messages in thread
From: Przemek Kitszel @ 2025-03-11  9:15 UTC (permalink / raw)
  To: Kyungwook Boo; +Cc: intel-wired-lan, netdev, Loktionov, Aleksandr, Tony Nguyen

On 3/11/25 06:16, Kyungwook Boo wrote:
> When the device sends a specific input, an integer underflow can occur, leading
> to MMIO write access to an invalid page.
> 
> Prevent the integer underflow by changing the type of related variables.
> 
> Signed-off-by: Kyungwook Boo <bookyungwook@gmail.com>
> Link: https://lore.kernel.org/lkml/ffc91764-1142-4ba2-91b6-8c773f6f7095@gmail.com/T/
> ---
> Changes in v2:
> - Formatting properly
> - Fix variable shadowing
> - Link to v1: https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-9304071e4579@gmail.com/
> ---
>   drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
> index 370b4bddee44..b11c35e307ca 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_common.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
> @@ -817,10 +817,11 @@ int i40e_pf_reset(struct i40e_hw *hw)
>   void i40e_clear_hw(struct i40e_hw *hw)
>   {
>   	u32 num_queues, base_queue;
> -	u32 num_pf_int;
> -	u32 num_vf_int;
> +	s32 num_pf_int;
> +	s32 num_vf_int;
>   	u32 num_vfs;
> -	u32 i, j;
> +	s32 i;
> +	u32 j;
>   	u32 val;
>   	u32 eol = 0x7ff;

thank you for localizing the improvement, now the code is more robust,
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

>   
> ---
> base-commit: 4d872d51bc9d7b899c1f61534e3dbde72613f627
> 
> Best regards,
> Kyungwook Boo
> 


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

* Re: [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw
  2025-03-11  5:16 [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw Kyungwook Boo
  2025-03-11  9:15 ` Przemek Kitszel
@ 2025-03-11 11:04 ` Simon Horman
  2025-03-21  4:46 ` [Intel-wired-lan] " Rinitha, SX
  2 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-03-11 11:04 UTC (permalink / raw)
  To: Kyungwook Boo
  Cc: Loktionov, Aleksandr, Przemek Kitszel, Tony Nguyen,
	intel-wired-lan, netdev

On Tue, Mar 11, 2025 at 02:16:02PM +0900, Kyungwook Boo wrote:
> When the device sends a specific input, an integer underflow can occur, leading
> to MMIO write access to an invalid page.
> 
> Prevent the integer underflow by changing the type of related variables.
> 
> Signed-off-by: Kyungwook Boo <bookyungwook@gmail.com>
> Link: https://lore.kernel.org/lkml/ffc91764-1142-4ba2-91b6-8c773f6f7095@gmail.com/T/
> ---
> Changes in v2:
> - Formatting properly
> - Fix variable shadowing
> - Link to v1: https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-9304071e4579@gmail.com/
> ---
>  drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
> index 370b4bddee44..b11c35e307ca 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_common.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
> @@ -817,10 +817,11 @@ int i40e_pf_reset(struct i40e_hw *hw)
>  void i40e_clear_hw(struct i40e_hw *hw)
>  {
>  	u32 num_queues, base_queue;
> -	u32 num_pf_int;
> -	u32 num_vf_int;
> +	s32 num_pf_int;
> +	s32 num_vf_int;
>  	u32 num_vfs;
> -	u32 i, j;
> +	s32 i;
> +	u32 j;
>  	u32 val;
>  	u32 eol = 0x7ff;
>  
> ---
> base-commit: 4d872d51bc9d7b899c1f61534e3dbde72613f627

I see that this addresses the problem at the first link above.
And I'd happy to see it accepted as-is.

Reviewed-by: Simon Horman <horms@kernel.org>

But, as an aside, wouldn't it be more appropriate to use generic
types like int and unsigned int for most of the above variables?
Perhaps this could be addressed by a follow-up. Or perhaps that
would just be churn, IDK.

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

* RE: [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw
  2025-03-11  9:15 ` Przemek Kitszel
@ 2025-03-12 13:22   ` Loktionov, Aleksandr
  0 siblings, 0 replies; 6+ messages in thread
From: Loktionov, Aleksandr @ 2025-03-12 13:22 UTC (permalink / raw)
  To: Kitszel, Przemyslaw, Kyungwook Boo
  Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	Nguyen, Anthony L



> -----Original Message-----
> From: Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
> Sent: Tuesday, March 11, 2025 10:15 AM
> To: Kyungwook Boo <bookyungwook@gmail.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Loktionov,
> Aleksandr <aleksandr.loktionov@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>
> Subject: Re: [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page
> in i40e_clear_hw
> 
> On 3/11/25 06:16, Kyungwook Boo wrote:
> > When the device sends a specific input, an integer underflow can
> > occur, leading to MMIO write access to an invalid page.
> >
> > Prevent the integer underflow by changing the type of related variables.
> >
> > Signed-off-by: Kyungwook Boo <bookyungwook@gmail.com>
> > Link:
> > https://lore.kernel.org/lkml/ffc91764-1142-4ba2-91b6-
> 8c773f6f7095@gmai
> > l.com/T/
> > ---
> > Changes in v2:
> > - Formatting properly
> > - Fix variable shadowing
> > - Link to v1:
> > https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-
> 9304071e4579@gm
> > ail.com/
> > ---
> >   drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++---
> >   1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c
> > b/drivers/net/ethernet/intel/i40e/i40e_common.c
> > index 370b4bddee44..b11c35e307ca 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_common.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
> > @@ -817,10 +817,11 @@ int i40e_pf_reset(struct i40e_hw *hw)
> >   void i40e_clear_hw(struct i40e_hw *hw)
> >   {
> >   	u32 num_queues, base_queue;
> > -	u32 num_pf_int;
> > -	u32 num_vf_int;
> > +	s32 num_pf_int;
> > +	s32 num_vf_int;
> >   	u32 num_vfs;
> > -	u32 i, j;
> > +	s32 i;
> > +	u32 j;
> >   	u32 val;
> >   	u32 eol = 0x7ff;
> 
> thank you for localizing the improvement, now the code is more robust,
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> >
> > ---
> > base-commit: 4d872d51bc9d7b899c1f61534e3dbde72613f627
> >
> > Best regards,
> > Kyungwook Boo
> >


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

* RE: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw
  2025-03-11  5:16 [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw Kyungwook Boo
  2025-03-11  9:15 ` Przemek Kitszel
  2025-03-11 11:04 ` Simon Horman
@ 2025-03-21  4:46 ` Rinitha, SX
  2025-03-24  9:27   ` Loktionov, Aleksandr
  2 siblings, 1 reply; 6+ messages in thread
From: Rinitha, SX @ 2025-03-21  4:46 UTC (permalink / raw)
  To: Kyungwook Boo, Loktionov, Aleksandr, Kitszel, Przemyslaw,
	Nguyen, Anthony L
  Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Kyungwook Boo
> Sent: 11 March 2025 10:46
> To: Loktionov, Aleksandr <aleksandr.loktionov@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>
Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org
> Subject: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw
>
> When the device sends a specific input, an integer underflow can occur, leading to MMIO write access to an invalid page.
>
> Prevent the integer underflow by changing the type of related variables.
>
> Signed-off-by: Kyungwook Boo <bookyungwook@gmail.com>
> Link: https://lore.kernel.org/lkml/ffc91764-1142-4ba2-91b6-8c773f6f7095@gmail.com/T/
> ---
> Changes in v2:
> - Formatting properly
> - Fix variable shadowing
> - Link to v1: https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-9304071e4579@gmail.com/
> ---
> drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>

Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)

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

* RE: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw
  2025-03-21  4:46 ` [Intel-wired-lan] " Rinitha, SX
@ 2025-03-24  9:27   ` Loktionov, Aleksandr
  0 siblings, 0 replies; 6+ messages in thread
From: Loktionov, Aleksandr @ 2025-03-24  9:27 UTC (permalink / raw)
  To: Rinitha, SX, Kyungwook Boo, Kitszel, Przemyslaw,
	Nguyen, Anthony L
  Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org



> -----Original Message-----
> From: Rinitha, SX <sx.rinitha@intel.com>
> Sent: Friday, March 21, 2025 5:47 AM
> To: Kyungwook Boo <bookyungwook@gmail.com>; Loktionov, Aleksandr
> <aleksandr.loktionov@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org
> Subject: RE: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access
> to an invalid page in i40e_clear_hw
> 
> > -----Original Message-----
> > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Kyungwook Boo
> > Sent: 11 March 2025 10:46
> > To: Loktionov, Aleksandr <aleksandr.loktionov@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org
> > Subject: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to
> an invalid page in i40e_clear_hw
> >
> > When the device sends a specific input, an integer underflow can occur,
> leading to MMIO write access to an invalid page.
> >
> > Prevent the integer underflow by changing the type of related variables.
> >
> > Signed-off-by: Kyungwook Boo <bookyungwook@gmail.com>
> > Link: https://lore.kernel.org/lkml/ffc91764-1142-4ba2-91b6-
> 8c773f6f7095@gmail.com/T/
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

> > ---
> > Changes in v2:
> > - Formatting properly
> > - Fix variable shadowing
> > - Link to v1: https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-
> 9304071e4579@gmail.com/
> > ---
> > drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> 
> Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)

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

end of thread, other threads:[~2025-03-24  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11  5:16 [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in i40e_clear_hw Kyungwook Boo
2025-03-11  9:15 ` Przemek Kitszel
2025-03-12 13:22   ` Loktionov, Aleksandr
2025-03-11 11:04 ` Simon Horman
2025-03-21  4:46 ` [Intel-wired-lan] " Rinitha, SX
2025-03-24  9:27   ` Loktionov, Aleksandr

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