i40e: fix MMIO write access to an invalid page in i40e_clear_hw
Subsystems (3)
PATCH v2 1/1 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.
---
Changes in v2:
- Formatting properly
- Fix variable shadowing
- Link to v1: https://lore.kernel.org/netdev/[email protected]/
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +4 -3
@@ -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
Quoted 24 lines · Kyungwook Boo
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 <[email protected]>---
Changes in v2:
- Formatting properly
- Fix variable shadowing
- Link to v1: https://lore.kernel.org/netdev/[email protected]/--- drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/i40e/i40e_common.c +0
-0@@ -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;
drivers/net/ethernet/intel/i40e/i40e_common.c int i40e_pf_reset(struct i40e_hw *hw) · line 826
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_common.c +4
-3-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,
Quoted 7 lines
drivers/net/ethernet/intel/i40e/i40e_common.c +0
-1---base-commit:
4d872d51bc9d7b899c1f61534e3dbde72613f627Best regards,
Kyungwook Boo
Quoted 36 lines · Kyungwook Boo
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 <[email protected]>---
Changes in v2:
- Formatting properly
- Fix variable shadowing
- Link to v1: https://lore.kernel.org/netdev/[email protected]/--- drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/i40e/i40e_common.c +4
-4@@ -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 ; ---
Quoted 1 line
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.
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.
Loktionov, Aleksandr
Reviewed-byQuoted 56 lines
-----Original Message-----
From: Kitszel, Przemyslaw <[email protected]>
Sent: Tuesday, March 11, 2025 10:15 AM
To: Kyungwook Boo <[email protected]>
Cc: [email protected]; [email protected]; Loktionov, Aleksandr <[email protected]>; Nguyen, Anthony L <[email protected]>
Subject: Re: [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page ini40e_clear_hwQuoted 8 lines · Kyungwook Boo
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 <[email protected]>8c773f6f7095@gmai
Quoted 7 lines
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
Quoted 14 lines
ail.com/
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/intel/i40e/i40e_common.c +0
-0@@ -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;drivers/net/ethernet/intel/i40e/i40e_common.c int i40e_pf_reset(struct i40e_hw *hw) · line 826
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_common.c +4
-3-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,
Quoted 1 line
Reviewed-by Przemek Kitszel <[email protected]>
Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/intel/i40e/i40e_common.c +0
-1---base-commit:
4d872d51bc9d7b899c1f61534e3dbde72613f627Best regards,
Kyungwook Boo
Quoted 4 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Kyungwook Boo
Sent: 11 March 2025 10:46
To: Loktionov, Aleksandr <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>
Quoted 8 lines
Subject: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page in
i40e_clear_hwWhen 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.
Quoted 9 lines
---
Changes in v2:
- Formatting properly
- Fix variable shadowing
- Link to v1: https://lore.kernel.org/netdev/[email protected]/
---drivers/net/ethernet/intel/i40e/i40e_common.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)
Loktionov, Aleksandr
Reviewed-byQuoted 24 lines
-----Original Message-----
From: Rinitha, SX <[email protected]>
Sent: Friday, March 21, 2025 5:47 AM
To: Kyungwook Boo <[email protected]>; Loktionov, Aleksandr <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to an invalid page ini40e_clear_hwQuoted 2 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf OfKyungwook Boo
Quoted 2 lines
Sent: 11 March 2025 10:46
To: Loktionov, Aleksandr <[email protected]>; Kitszel,Przemyslaw <[email protected]>; Nguyen, Anthony L <[email protected]>
Cc: [email protected]; [email protected]Quoted 1 line
Subject: [Intel-wired-lan] [PATCH iwl-next v2] i40e: fix MMIO write access to
an invalid page in
i40e_clear_hwQuoted 1 line
Quoted 8 lines
Quoted 1 line
When the device sends a specific input, an integer underflow can occur,
leading to MMIO write access to an invalid page.
Quoted 5 lines
Prevent the integer underflow by changing the type of related variables.
Quoted 12 lines
Quoted 5 lines
---
Changes in v2:
- Formatting properly
- Fix variable shadowing
- Link to v1: https://lore.kernel.org/netdev/55acc5dc-8d5a-45bc-a59c-Quoted 4 lines
---
drivers/net/ethernet/intel/i40e/i40e_common.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)