Commit f30490e
i40e: fix race condition by adding filter's intermediate sync state
Fix a race condition in the i40e driver that leads to MAC/VLAN filters
becoming corrupted and leaking. Address the issue that occurs under
heavy load when multiple threads are concurrently modifying MAC/VLAN
filters by setting mac and port VLAN.
1. Thread T0 allocates a filter in i40e_add_filter() within
i40e_ndo_set_vf_port_vlan().
2. Thread T1 concurrently frees the filter in __i40e_del_filter() within
i40e_ndo_set_vf_mac().
3. Subsequently, i40e_service_task() calls i40e_sync_vsi_filters(), which
refers to the already freed filter memory, causing corruption.
Reproduction steps:
1. Spawn multiple VFs.
2. Apply a concurrent heavy load by running parallel operations to change
MAC addresses on the VFs and change port VLANs on the host.
3. Observe errors in dmesg:
"Error I40E_AQ_RC_ENOSPC adding RX filters on VF XX,
please set promiscuous on manually for VF XX".
Exact code for stable reproduction Intel can't open-source now.
The fix involves implementing a new intermediate filter state,
I40E_FILTER_NEW_SYNC, for the time when a filter is on a tmp_add_list.
These filters cannot be deleted from the hash list directly but
must be removed using the full process.
Fixes: 278e7d0 ("i40e: store MAC/VLAN filters in a hash with the MAC Address as key")
Signed-off-by: Aleksandr Loktionov <[email protected]>
Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)
Reviewed-by: Michal Schmidt <[email protected]>
Tested-by: Michal Schmidt <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>1 parent 9b58031 commit f30490e
File tree
3 files changed
+12
-2
lines changed- drivers/net/ethernet/intel/i40e
3 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
| 758 | + | |
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1255 | 1255 | | |
1256 | 1256 | | |
1257 | 1257 | | |
| 1258 | + | |
1258 | 1259 | | |
1259 | 1260 | | |
1260 | 1261 | | |
| |||
1441 | 1442 | | |
1442 | 1443 | | |
1443 | 1444 | | |
| 1445 | + | |
| 1446 | + | |
1444 | 1447 | | |
1445 | 1448 | | |
1446 | 1449 | | |
| |||
1550 | 1553 | | |
1551 | 1554 | | |
1552 | 1555 | | |
| 1556 | + | |
| 1557 | + | |
1553 | 1558 | | |
1554 | 1559 | | |
1555 | 1560 | | |
| |||
2437 | 2442 | | |
2438 | 2443 | | |
2439 | 2444 | | |
2440 | | - | |
| 2445 | + | |
| 2446 | + | |
2441 | 2447 | | |
2442 | 2448 | | |
2443 | 2449 | | |
| |||
2611 | 2617 | | |
2612 | 2618 | | |
2613 | 2619 | | |
| 2620 | + | |
2614 | 2621 | | |
2615 | 2622 | | |
2616 | 2623 | | |
| |||
2762 | 2769 | | |
2763 | 2770 | | |
2764 | 2771 | | |
2765 | | - | |
| 2772 | + | |
| 2773 | + | |
2766 | 2774 | | |
2767 | 2775 | | |
2768 | 2776 | | |
| |||
0 commit comments