Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: houminxi@gmail.com
Cc: netdev@vger.kernel.org, dev@openvswitch.org, aconole@redhat.com,
	echaudro@redhat.com, i.maximets@ovn.org, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, matttbe@kernel.org, shuah@kernel.org,
	netdev-bot+sashiko@kernel.org
Subject: Re: [PATCH net v6 1/3] net: openvswitch: read the datapath features once when sending an upcall
Date: Wed, 25 Nov 2026 14:53:01 +0000	[thread overview]
Message-ID: <179561838178.3135.17043215376942642309@kernel.org> (raw)
In-Reply-To: <20261124145033.627044-2-houminxi@gmail.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] In net/openvswitch/datapath.c, the comment added to
  queue_userspace_packet() above `features =…

--

net: openvswitch: read the datapath features once when sending an upcall

queue_userspace_packet() reads dp->user_features once to decide whether
the packet is copied linearly. pad_packet() reads it again after the copy.
A concurrent OVS_DP_CMD_SET can change the bit between the two reads, and
pad_packet() can then call skb_put_zero() on a nonlinear skb. The patch
reads the field once and passes that value to pad_packet().

> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index b2a0b09fd4a56..96baa2488c266 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c

[ ... ]

> @@ -494,11 +495,18 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
>  	    (err = skb_csum_hwoffload_help(skb, 0)))
>  		goto out;
>
> +	/* A concurrent change to the features can land between the head room
> +	 * decision below and the padding after the copy, which would pad a
> +	 * nonlinear skb and trip SKB_LINEAR_ASSERT. Read the field once and use
> +	 * that value for both.
> +	 */

[Severity: Low]
This isn't a bug, but is "head room decision" the right term for this
comment in queue_userspace_packet()?

The code below doesn't decide any headroom. It picks hlen, the number of
bytes skb_zerocopy() copies into the linear part of user_skb:

	if (features & OVS_DP_F_UNALIGNED)
		hlen = min(skb_zerocopy_headlen(skb), cutlen);
	else
		hlen = skb_len;

hlen then sizes the message in upcall_msg_size() and is passed as the
linear copy length to skb_zerocopy(user_skb, skb, skb_len, hlen).

In skb code, headroom usually means skb_headroom(). struct datapath also
has a separate max_headroom field, which isn't involved here.

Could the comment say "linear copy length (hlen)" instead? The later
patches in the series don't change this comment.

> +	features = READ_ONCE(dp->user_features);
> +
>  	/* Older versions of OVS user space enforce alignment of the last
>  	 * Netlink attribute to NLA_ALIGNTO which would require extensive
>  	 * padding logic. Only perform zerocopy if padding is not required.
>  	 */
> -	if (dp->user_features & OVS_DP_F_UNALIGNED)
> +	if (features & OVS_DP_F_UNALIGNED)
>  		hlen = min(skb_zerocopy_headlen(skb), cutlen);
>  	else
>  		hlen = skb_len;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124145033.627044-1-houminxi%40gmail.com

  reply	other threads:[~2026-11-25 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:50 [PATCH net v6 0/3] net: openvswitch: fix a feature leak on a failed change Minxi Hou
2026-11-24 14:50 ` [PATCH net v6 1/3] net: openvswitch: read the datapath features once when sending an upcall Minxi Hou
2026-11-25 14:53   ` netdev-bot+sashiko [this message]
2026-11-24 14:50 ` [PATCH net v6 2/3] net: openvswitch: do not record user features when the change fails Minxi Hou
2026-11-25 14:53   ` netdev-bot+sashiko
2026-11-24 14:50 ` [PATCH net v6 3/3] selftests/net/openvswitch: check that a failed set keeps the features Minxi Hou
2026-11-25 14:53   ` netdev-bot+sashiko
2026-11-24 14:52 ` [PATCH net v6 0/3] net: openvswitch: fix a feature leak on a failed change netdev-bot+sinfo
2026-11-24 15:08   ` Minxi Hou

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=179561838178.3135.17043215376942642309@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aconole@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=houminxi@gmail.com \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox