All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mingming Cao <mmc@linux.ibm.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, horms@kernel.org,
	edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch,
	nnac123@linux.ibm.com, maddy@linux.ibm.com, mpe@ellerman.id.au,
	linuxppc-dev@lists.ozlabs.org, davemarq@linux.ibm.com,
	bjking1@linux.ibm.com, Mingming Cao <mmc@linux.ibm.com>
Subject: [PATCH net-next 0/7] ibmveth: fix hangs, use-after-frees and netpoll races
Date: Fri,  2 Oct 2026 18:57:12 -0700	[thread overview]
Message-ID: <cover.1790991039.git.mmc@linux.ibm.com> (raw)

Hi,

Seven fixes for serious bugs in the ibmveth driver: two hang the
system, three are use-after-frees, one corrupts memory, and one makes
ethtool -L report success when it failed.

The series is based on net-next commit 071876fd5048 ("ref_tracker: Don't
use __GFP_NOFAIL for PF_MEMALLOC thread."). It does not depend on
the two open() error-path fixes recently applied to net
(commit af0524bf4ce1, commit 84bec0bf0352) and merges cleanly with them;
patch 2 explains how it relates to them. It also applies to net with
git am -3.

  1. Netpoll races with RX replenish (memory corruption, NULL
     dereference): remove ndo_poll_controller, as was done for
     ibmvnic, and enable NAPI only once the RX resources exist.
     Fixes: 6b4223748895 ("[PATCH] ibmveth: Add netpoll function")
     Fixes: bea3348eef27 ("[NET]: Make NAPI polling independent of struct net_device objects.")

  2. Hang after a failed internal reopen: the next close() waits in
     napi_disable() forever with RTNL held, and only a reboot
     recovers. Skip close() when open() did not succeed.
     Fixes: 860f242eb534 ("[PATCH] ibmveth change buffer pools dynamically")

  3. Use-after-free in remove(): a reset queued from NAPI could run
     on the freed adapter. Disable the reset work first.
     Fixes: 2c91e2319ed9 ("net: ibmveth: Reset the adapter when unexpected states are detected")

  4. RX poll hang on a bad correlator: poll restarts on the same slot
     until RCU stalls, and an inactive pool dereferences NULL. Step
     past the slot, reject inactive pools, count the drop.
     Fixes: 2c91e2319ed9 ("net: ibmveth: Reset the adapter when unexpected states are detected")
     Fixes: 860f242eb534 ("[PATCH] ibmveth change buffer pools dynamically")

  5. Use-after-free after a failed probe: the pool kobjects stay in
     sysfs after the adapter is freed. Put them, as remove() does.
     The pool kobjects have no release(), so with
     CONFIG_DEBUG_KOBJECT_RELEASE a short window remains here and in
     remove(); giving them a release() is left for a follow-up.
     Fixes: 860f242eb534 ("[PATCH] ibmveth change buffer pools dynamically")

  6. ethtool -L returns 0 when it cannot allocate the new TX queues.
     Return the allocation error.
     Fixes: 10c2aba89cc0 ("ibmveth: Ethtool set queue support")

  7. Use-after-free of TX buffers: close(), called directly for MTU,
     offload and buffer pool changes, frees them without waiting for
     a running transmit. Use netif_tx_disable().
     Fixes: d6832ca48d8a ("ibmveth: Copy tx skbs into a premapped buffer")

The triggers are rare and there are no field reports, so the series
targets net-next. All carry Fixes: tags; I am happy to repost
against net, or add Cc: stable, if you prefer.

All were found by AI-assisted review of the ibmveth multi-queue
RX series [1]. Landing them first also shrinks that series, which
then only extends this handling per queue.

Testing: the new and extended KUnit cases in patch 4 fail on the
unfixed driver and pass on qemu pseries (ppc64le). On a POWER10
LPAR: netconsole under printk and ping floods, MTU and buffer pool
changes under traffic, a forced open() failure followed by down and
up, unbind/bind under traffic, a forced register_netdev() failure in
probe, and ethtool -L with a forced TX buffer allocation failure.

[1] https://lore.kernel.org/netdev/cover.1790319558.git.mmc@linux.ibm.com/

Thanks,
Mingming

Mingming Cao (7):
  ibmveth: fix netpoll races with RX replenish
  ibmveth: do not close twice after a failed reopen
  ibmveth: disable the reset work before unregister in remove
  ibmveth: step past bad RX correlators instead of spinning or oopsing
  ibmveth: release the pool kobjects when probe fails
  ibmveth: return the error when set_channels cannot add TX queues
  ibmveth: wait for in-flight transmits in ibmveth_close()

 drivers/net/ethernet/ibm/ibmveth.c | 238 ++++++++++++++++++++++-------
 drivers/net/ethernet/ibm/ibmveth.h |   2 +
 2 files changed, 184 insertions(+), 56 deletions(-)

-- 
2.39.3 (Apple Git-146)

             reply	other threads:[~2026-10-03  1:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03  1:57 Mingming Cao [this message]
2026-10-03  1:57 ` [PATCH net-next 1/7] ibmveth: fix netpoll races with RX replenish Mingming Cao
2026-10-03  1:57 ` [PATCH net-next 2/7] ibmveth: do not close twice after a failed reopen Mingming Cao
2026-10-03  1:57 ` [PATCH net-next 3/7] ibmveth: disable the reset work before unregister in remove Mingming Cao
2026-10-03  1:57 ` [PATCH net-next 4/7] ibmveth: step past bad RX correlators instead of spinning or oopsing Mingming Cao
2026-10-04  2:12   ` netdev-bot+sashiko
2026-10-03  1:57 ` [PATCH net-next 5/7] ibmveth: release the pool kobjects when probe fails Mingming Cao
2026-10-04  2:12   ` netdev-bot+sashiko
2026-10-05  6:27     ` mingming cao
2026-10-03  1:57 ` [PATCH net-next 6/7] ibmveth: return the error when set_channels cannot add TX queues Mingming Cao
2026-10-03  1:57 ` [PATCH net-next 7/7] ibmveth: wait for in-flight transmits in ibmveth_close() Mingming Cao

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=cover.1790991039.git.mmc@linux.ibm.com \
    --to=mmc@linux.ibm.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjking1@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=davemarq@linux.ibm.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=nnac123@linux.ibm.com \
    --cc=pabeni@redhat.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 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.