All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Showta Ishizaki" <zakinko@snowrabbit.org>
Cc: virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH RFC net v11 2/6] um: vector: trim skbs before verifying the header
Date: Sat, 05 Dec 2026 04:01:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-251039@kernel.org> (raw)
In-Reply-To: <20261204.rfcv11.99731.2.zakinko@snowrabbit.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] um: vector: NULL skb dereference in vector_mmsg_rx() on
  allocation failure
--

commit e31f8cf054920da38ad1454a853c93da403fdef4
Author: Michael S. Tsirkin <mst@redhat.com>

um: vector: trim skbs before verifying the header

This commit moves pskb_trim() ahead of vp->verify_header() in
vector_legacy_rx() and vector_mmsg_rx() so that received skbs are trimmed
before header verification.

> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index e902e78c5ff67..828bd61995b86 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c

[ ... ]

> @@ -989,6 +989,8 @@ static int vector_mmsg_rx(struct vector_private *vp, int budget)
>  	for (i = 0; i < packet_count; i++) {
>  		skb = (*skbuff_vector);
>  		if (mmsg_vector->msg_len > vp->header_size) {
> +			pskb_trim(skb,
> +				mmsg_vector->msg_len - vp->rx_header_size);
>  			if (vp->header_size > 0) {
>  				header_check = vp->verify_header(
>  					mmsg_vector->msg_hdr.msg_iov->iov_base,

[Severity: High]
Can pskb_trim() dereference a NULL skb here when allocation fails?

When prep_skb() fails its GFP_ATOMIC allocation with vp->header_size > 0,
it stores NULL in *skbuff_vector while leaving iov[0] sized to
vp->rx_header_size.

For IPv4 GRE, build_gre_transport_data() adds sizeof(struct iphdr) to
vp->rx_header_size, so an incoming packet into that slot can satisfy
mmsg_vector->msg_len > vp->header_size while skb is NULL.

Before this patch, packets rejected by vp->verify_header() went straight
to NULL-safe dev_kfree_skb_irq(skb) and skipped pskb_trim().  Moving
pskb_trim() first causes a NULL pointer dereference in NAPI softirq even
for invalid or unauthenticated packets.

Checking skb != NULL (and mmsg_vector->msg_len > vp->rx_header_size)
before calling pskb_trim() would avoid this.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204.rfcv11.99731.0.zakinko@snowrabbit.org?part=2

  reply	other threads:[~2026-12-05  4:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  4:01 [PATCH RFC net v11 0/6] more virtio-net csum hardening Showta Ishizaki
2026-12-04  4:01 ` [PATCH RFC net v11 4/6] net: resolve uncommon partial checksums at ingress Showta Ishizaki
2026-12-05  4:01   ` sashiko-bot
2026-12-04  4:01 ` [PATCH RFC net v11 3/6] virtio_net: parse tunnel csum_start little-endian Showta Ishizaki
2026-12-04  4:01 ` [PATCH RFC net v11 1/6] net: account for ingress-resolved virtio net hdr state Showta Ishizaki
2026-12-05  4:01   ` sashiko-bot
2026-12-04  4:01 ` [PATCH RFC net v11 2/6] um: vector: trim skbs before verifying the header Showta Ishizaki
2026-12-05  4:01   ` sashiko-bot [this message]
2026-12-04  4:01 ` [PATCH RFC net v11 5/6] net: virtio: compute the outer checksum of non-GSO tunnel packets Showta Ishizaki
2026-12-05  4:01   ` sashiko-bot
2026-12-04  4:01 ` [PATCH RFC net v11 6/6] net: add a sysctl to opt out of virtio net hdr checksum validation Showta Ishizaki
2026-12-05  4:01   ` sashiko-bot
2026-12-04  4:06 ` [PATCH RFC net v11 0/6] more virtio-net csum hardening netdev-bot+sinfo
2026-12-05  4:01 ` sashiko-bot

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-251039@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=virtualization@lists.linux.dev \
    --cc=zakinko@snowrabbit.org \
    /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.