Skip to contentSkip to conversation

sfc: handle rhashtable walk errors in mport lookup

PATCH Applied Sang-Hoon Choi 3 participants 3 messages Oct 2 – Oct 7

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sfc: handle rhashtable walk errors in mport lookup

rhashtable_walk_next() can return ERR_PTR(-EAGAIN) when the table is resized. efx_mae_lookup_mport() currently dereferences that value as an mport descriptor.

Skip error values and continue the walk, as the other rhashtable walkers in this driver already do.

Fixes 5227adff37af ("sfc: add mport lookup based on driver's mport data")
Assisted-by LLM

---
Compile-tested the affected object with x86_64 allmodconfig
and W=1 (GCC 13.3.0). Base: mainline 3b7cab693ba2bab63774bf5b988e8a61b2ef0f32. No hardware testing or runtime failure reproduction was performed.

 drivers/net/ethernet/sfc/mae.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/sfc/mae.c +2 -0
index 7a8606efd492..b6de61062a86 100644
@@ -1030,6 +1030,8 @@ int efx_mae_lookup_mport(struct efx_nic *efx, u32 vf_idx, u32 *id)
 	rhashtable_walk_enter(&mae->mports_ht, &walk);
 	rhashtable_walk_start(&walk);
 	while ((m = rhashtable_walk_next(&walk)) != NULL) {
+		if (IS_ERR(m))
+			continue;
 		if (m->mport_type == MAE_MPORT_DESC_MPORT_TYPE_VNIC &&
 		    m->interface_idx == nic_data->local_mae_intf &&
 		    m->pf_idx == 0 &&
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Sang-Hoon Choi

rhashtable_walk_next() can return ERR_PTR(-EAGAIN) when the table is resized. efx_mae_lookup_mport() currently dereferences that value as an mport descriptor.

Skip error values and continue the walk, as the other rhashtable walkers in this driver already do.

Quoted 8 lines
Fixes 5227adff37af ("sfc: add mport lookup based on driver's mport data")
Assisted-by LLM

---
Compile-tested the affected object with x86_64 allmodconfig
and W=1 (GCC 13.3.0). Base: mainline 3b7cab693ba2bab63774bf5b988e8a61b2ef0f32. No hardware testing or runtime failure reproduction was performed.

#2 lore raw
In reply to Sang-Hoon Choi
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Fri, 02 Oct 2026 19:47:40 +0000 you wrote:

rhashtable_walk_next() can return ERR_PTR(-EAGAIN) when the table is resized. efx_mae_lookup_mport() currently dereferences that value as an mport descriptor.

Skip error values and continue the walk, as the other rhashtable walkers in this driver already do.

[...]

Here is the summary with links:
- [net] sfc: handle rhashtable walk errors in mport lookup

    https://git.kernel.org/netdev/net-next/c/2a1359aa651f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html