BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Subasri S" <subasris1210@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] netdevsim: update rxq->napi pointer during queue reset
Date: Wed, 12 Aug 2026 14:02:35 +0000	[thread overview]
Message-ID: <20260812140235.8AC2B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812-net-netdevsim-v1-1-521a85e4fe91@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch clears `rxq->napi` in `nsim_queue_stop()` but fails to restore it in `nsim_queue_start()` when `rq_reset_mode == 1`, breaking NAPI-dependent features.
--

--- Patch [1]: [PATCH] netdevsim: update rxq->napi pointer during queue reset ---
commit a7e8e5d48bb567359bb7891a0b39d7f888c35d27
Author: Subasri S <subasris1210@gmail.com>

netdevsim: update rxq->napi pointer during queue reset

This commit addresses a use-after-free issue by properly clearing and setting
the rxq->napi pointer during a queue reset. It modifies nsim_queue_stop() to
clear the pointer and nsim_queue_start() to set it to the new napi instance.

Closes: https://syzkaller.appspot.com/bug?extid=c06674caba265dc61d46

> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index 4e9d7e10b527e..c18f9f540084a 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c

[ ... ]

> @@ -826,6 +826,8 @@ nsim_queue_start(struct net_device *dev, struct netdev_queue_config *qcfg,
>  	}
>  
>  	ns->rq[idx] = qmem->rq;
> +	netif_queue_set_napi(dev, idx, NETDEV_QUEUE_TYPE_RX,
> +			     &ns->rq[idx]->napi);

[Severity: Medium]
Will this leave rxq->napi as NULL when ns->rq_reset_mode == 1?

Since nsim_queue_stop() now unconditionally sets the pointer to NULL:

drivers/net/netdevsim/netdev.c:nsim_queue_stop() {
	...
	netif_queue_set_napi(dev, idx, NETDEV_QUEUE_TYPE_RX, NULL);
	...
}

Earlier in this function (nsim_queue_start), there is an early return
for rq_reset_mode == 1 that bypasses the new restoration code:

drivers/net/netdevsim/netdev.c:nsim_queue_start() {
	...
	if (ns->rq_reset_mode == 1) {
		ns->rq[idx]->page_pool = qmem->pp;
		napi_enable_locked(&ns->rq[idx]->napi);
		return 0;
	}
	...
}

Does this skip restoring rxq->napi, leaving it NULL and preventing XSK busy
polling from working after a reset in mode 1?

>  	napi_enable_locked(&ns->rq[idx]->napi);
>  
>  	return 0;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812-net-netdevsim-v1-1-521a85e4fe91@gmail.com?part=1

      reply	other threads:[~2026-08-12 14:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 13:49 [PATCH] netdevsim: update rxq->napi pointer during queue reset Subasri S
2026-08-12 14:02 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260812140235.8AC2B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=subasris1210@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox