sfc: handle rhashtable walk errors in mport lookup
Subsystems (3)
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.
---
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
@@ -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 &&
Quoted 7 lines · Sang-Hoon Choi
rhashtable_walk_next()can returnERR_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")Reported-by Changyul Lee <[email protected]>Assisted-by LLMSigned-off-by Sang-Hoon Choi <[email protected]>---
Compile-tested the affected object withx86_64allmodconfig
and W=1 (GCC 13.3.0). Base: mainline3b7cab693ba2bab63774bf5b988e8a61b2ef0f32. No hardware testing or runtime failure reproduction was performed.
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 returnERR_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