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
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev