Netdev List
 help / color / mirror / Atom feed
* [PATCH net] sfc: siena: use reset_work in efx_siena_sriov_reset_vf_work()
@ 2026-12-04  3:11 Ziheng Wei
  2026-12-04 10:02 ` Austin, Alex (DCCG)
  0 siblings, 1 reply; 2+ messages in thread
From: Ziheng Wei @ 2026-12-04  3:11 UTC (permalink / raw)
  To: Alex Austin, Andy Moreton, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-net-drivers, linux-kernel, stable

efx_siena_sriov_reset_vf_work() is initialized on vf->reset_work via
INIT_WORK(&vf->reset_work, efx_siena_sriov_reset_vf_work), but computes
vf using container_of(work, struct siena_vf, req) instead.

When the work item runs, container_of() computes a mis-offset struct
siena_vf pointer, causing vf->efx to read an unrelated field instead of
the real struct efx_nic pointer and triggering an invalid pointer
dereference and kernel oops in efx_siena_alloc_buffer().

Use the matching reset_work member in container_of().

Found by LLM-assisted static analysis. Compile-tested on x86_64.

Fixes: cd2d5b529cdb ("sfc: Add SR-IOV back-end support for SFC9000 family")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
---
 drivers/net/ethernet/sfc/siena/siena_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/siena/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c
index df7157275..6178d03fc 100644
--- a/drivers/net/ethernet/sfc/siena/siena_sriov.c
+++ b/drivers/net/ethernet/sfc/siena/siena_sriov.c
@@ -1007,7 +1007,7 @@ static void efx_siena_sriov_reset_vf(struct siena_vf *vf,
 
 static void efx_siena_sriov_reset_vf_work(struct work_struct *work)
 {
-	struct siena_vf *vf = container_of(work, struct siena_vf, req);
+	struct siena_vf *vf = container_of(work, struct siena_vf, reset_work);
 	struct efx_nic *efx = vf->efx;
 	struct efx_buffer buf;
 

base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] sfc: siena: use reset_work in efx_siena_sriov_reset_vf_work()
  2026-12-04  3:11 [PATCH net] sfc: siena: use reset_work in efx_siena_sriov_reset_vf_work() Ziheng Wei
@ 2026-12-04 10:02 ` Austin, Alex (DCCG)
  0 siblings, 0 replies; 2+ messages in thread
From: Austin, Alex (DCCG) @ 2026-12-04 10:02 UTC (permalink / raw)
  To: Ziheng Wei, Andy Moreton, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev, linux-net-drivers, linux-kernel, stable



On 04/12/2026 03:11, Ziheng Wei wrote:
> 
> efx_siena_sriov_reset_vf_work() is initialized on vf->reset_work via
> INIT_WORK(&vf->reset_work, efx_siena_sriov_reset_vf_work), but computes
> vf using container_of(work, struct siena_vf, req) instead.
> 
> When the work item runs, container_of() computes a mis-offset struct
> siena_vf pointer, causing vf->efx to read an unrelated field instead of
> the real struct efx_nic pointer and triggering an invalid pointer
> dereference and kernel oops in efx_siena_alloc_buffer().
> 
> Use the matching reset_work member in container_of().
> 
> Found by LLM-assisted static analysis. Compile-tested on x86_64.
> 
> Fixes: cd2d5b529cdb ("sfc: Add SR-IOV back-end support for SFC9000 family")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ziheng Wei <zihengw03@163.com>
> ---
>  drivers/net/ethernet/sfc/siena/siena_sriov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/sfc/siena/siena_sriov.c b/drivers/net/ethernet/sfc/siena/siena_sriov.c
> index df7157275..6178d03fc 100644
> --- a/drivers/net/ethernet/sfc/siena/siena_sriov.c
> +++ b/drivers/net/ethernet/sfc/siena/siena_sriov.c
> @@ -1007,7 +1007,7 @@ static void efx_siena_sriov_reset_vf(struct siena_vf *vf,
> 
>  static void efx_siena_sriov_reset_vf_work(struct work_struct *work)
>  {
> -       struct siena_vf *vf = container_of(work, struct siena_vf, req);
> +       struct siena_vf *vf = container_of(work, struct siena_vf, reset_work);
>         struct efx_nic *efx = vf->efx;
>         struct efx_buffer buf;
> 
> 
> base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
> --
> 2.43.0

Reviewed-by: Alex Austin <alex.austin@amd.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 10:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  3:11 [PATCH net] sfc: siena: use reset_work in efx_siena_sriov_reset_vf_work() Ziheng Wei
2026-12-04 10:02 ` Austin, Alex (DCCG)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox