qede: Fix memset corruption
Subsystems (3)
PATCH 1/1 qede: Fix memset corruption
Thanks to Kees Cook who detected the problem of memset that starting from not the first member, but sized for the whole struct. The better change will be to remove the redundant memset and to clear only the msix_cnt member.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_main.c +1 -1
@@ -1866,6 +1866,7 @@ static void qede_sync_free_irqs(struct qede_dev *edev) } edev->int_info.used_cnt =0 ; + edev->int_info.msix_cnt =0 ; }static int qede_req_msix_irqs (struct qede_dev *edev)
@@ -2419,7 +2420,6 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, goto out; err4:qede_sync_free_irqs (edev); -memset (&edev->int_info.msix_cnt,0 ,sizeof (struct qed_int_info )); err3:qede_napi_disable_remove (edev); err2:
Signature · 1 line
2.22.0
Quoted 4 lines · Shai Malin
Thanks to Kees Cook who detected the problem of memset that starting from not the first member, but sized for the whole struct. The better change will be to remove the redundant memset and to clear only the
msix_cntmember.
Okay, thanks. It wasn't clear if this needs to be _only_ the msix_cnt member or something else.
Quoted 4 lines
Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ariel Elior <[email protected]>Signed-off-by Shai Malin <[email protected]>
-Kees
Quoted 27 lines
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/qlogic/qede/qede_main.c +1
-1@@ -1866,6 +1866,7 @@ static void qede_sync_free_irqs(struct qede_dev *edev) } edev->int_info.used_cnt =0 ; + edev->int_info.msix_cnt =0 ; }static int qede_req_msix_irqs (struct qede_dev *edev)@@ -2419,7 +2420,6 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, goto out; err4:qede_sync_free_irqs (edev); -memset (&edev->int_info.msix_cnt,0 ,sizeof (struct qed_int_info )); err3:qede_napi_disable_remove (edev); err2:Signature · 1 line
2.22.0
Signature · 1 line
Kees Cook
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 10 lines · On Tue, 24 Aug 2021 19:52:49 +0300 you wrote:
Thanks to Kees Cook who detected the problem of memset that starting from not the first member, but sized for the whole struct. The better change will be to remove the redundant memset and to clear only the
msix_cntmember.Signed-off-by Prabhakar Kushwaha <[email protected]>Signed-off-by Ariel Elior <[email protected]>Signed-off-by Shai Malin <[email protected]>[...]
Here is the summary with links:
- qede: Fix memset corruption
https://git.kernel.org/netdev/net/c/e543468869e2
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html