Commit 3f95a74
i40e: i40e_main: fix a missing check on list iterator
The bug is here:
ret = i40e_add_macvlan_filter(hw, ch->seid, vdev->dev_addr, &aq_err);
The list iterator 'ch' will point to a bogus position containing
HEAD if the list is empty or no element is found. This case must
be checked before any use of the iterator, otherwise it will
lead to a invalid memory access.
To fix this bug, use a new variable 'iter' as the list iterator,
while use the origin variable 'ch' as a dedicated pointer to
point to the found element.
Cc: stable@vger.kernel.org
Fixes: 1d8d80b ("i40e: Add macvlan support on i40e")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20220510204846.2166999-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 8b79647 commit 3f95a74
1 file changed
Lines changed: 14 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7549 | 7549 | | |
7550 | 7550 | | |
7551 | 7551 | | |
| 7552 | + | |
7552 | 7553 | | |
7553 | | - | |
7554 | 7554 | | |
7555 | 7555 | | |
7556 | 7556 | | |
7557 | | - | |
7558 | | - | |
7559 | | - | |
7560 | 7557 | | |
7561 | | - | |
7562 | | - | |
7563 | | - | |
| 7558 | + | |
| 7559 | + | |
| 7560 | + | |
7564 | 7561 | | |
7565 | 7562 | | |
7566 | 7563 | | |
7567 | 7564 | | |
7568 | | - | |
7569 | | - | |
7570 | | - | |
| 7565 | + | |
| 7566 | + | |
| 7567 | + | |
7571 | 7568 | | |
7572 | 7569 | | |
7573 | 7570 | | |
7574 | | - | |
| 7571 | + | |
7575 | 7572 | | |
7576 | 7573 | | |
7577 | 7574 | | |
7578 | | - | |
| 7575 | + | |
7579 | 7576 | | |
7580 | 7577 | | |
7581 | 7578 | | |
7582 | | - | |
| 7579 | + | |
7583 | 7580 | | |
| 7581 | + | |
7584 | 7582 | | |
7585 | 7583 | | |
7586 | 7584 | | |
7587 | 7585 | | |
| 7586 | + | |
| 7587 | + | |
| 7588 | + | |
7588 | 7589 | | |
7589 | 7590 | | |
7590 | 7591 | | |
| |||
0 commit comments