All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mina Almasry" <almasrymina@google.com>, dri-devel@lists.freedesktop.org
Cc: media-ci@linuxtv.org
Subject: Re: [PATCH net v3 3/4] netdevsim: support devmem RX and TX bindings
Date: Thu, 15 Oct 2026 16:18:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-173163@kernel.org> (raw)
In-Reply-To: <20261014161754.3782346-4-almasrymina@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] netdevsim: NULL pointer dereference in nsim_pp_hold_write() for VF
--

commit d75afa7b1b5f97be20adbad5ccb5b51d01ca5219
Author: Mina Almasry <almasrymina@google.com>
Date:   Wed Oct 14 16:17:53 2026 +0000

netdevsim: support devmem RX and TX bindings

This commit enables NETMEM_TX_DMA and configures page_pool instances to
support devmem bind-rx and bind-tx operations in netdevsim software tests.
It updates the pp_hold debugfs file to allocate pages from queue 0, adds
a netdev instance lock to prevent concurrent binding swaps, and checks if
the pool is backed by a memory provider.

> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index b4a99f3ceac60..357ea9e5623b3 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c

[ ... ]

> @@ -929,12 +939,15 @@ nsim_pp_hold_write(struct file *file, const char __user *data,
>  		return ret;
>  
>  	rtnl_lock();
> +	netdev_lock(ns->netdev);
>  	ret = count;
>  	if (val == !!ns->page)
>  		goto exit;
>  
>  	if (!netif_running(ns->netdev) && val) {
>  		ret = -ENETDOWN;
> +	} else if (val && page_pool_is_unreadable(ns->rq[0]->page_pool)) {

[Severity: High]
Does this code dereference a NULL pointer for Virtual Function (VF)
interfaces?

When a VF interface is created and brought up (e.g., via
ip link set dev ethX up, setting netif_running() to true), nsim_queue_init()
is skipped during VF creation, which leaves ns->rq as NULL.

If a user with debugfs write permissions then writes to the VF's pp_hold
file, this condition attempts to evaluate ns->rq[0], dereferencing NULL and
causing a kernel panic.

> +		ret = -EOPNOTSUPP;
>  	} else if (val) {
>  		ns->page = page_pool_dev_alloc_pages(ns->rq[0]->page_pool);
>  		if (!ns->page)

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014161754.3782346-1-almasrymina@google.com?part=3

  reply	other threads:[~2026-10-15 16:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 16:17 [PATCH net v3 0/4] net: devmem: fix RX and TX binding teardown on device unregistration Mina Almasry
2026-10-14 16:17 ` [PATCH net v3 1/4] net: devmem: unmap dma_buf synchronously on queue uninstall Mina Almasry
2026-10-15 16:18   ` sashiko-bot
2026-10-15 19:21   ` netdev-bot+sashiko
2026-10-14 16:17 ` [PATCH net v3 2/4] net: devmem: detach TX bindings on NETDEV_UNREGISTER Mina Almasry
2026-10-15 19:21   ` netdev-bot+sashiko
2026-10-14 16:17 ` [PATCH net v3 3/4] netdevsim: support devmem RX and TX bindings Mina Almasry
2026-10-15 16:18   ` sashiko-bot [this message]
2026-10-15 19:21   ` netdev-bot+sashiko
2026-10-14 16:17 ` [PATCH net v3 4/4] selftests: net: add devmem RX and TX netdev unregister tests Mina Almasry

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=sashiko-outbox-173163@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=almasrymina@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.