netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] virtio-net: zero unused hash fields
@ 2025-10-21  4:01 Jason Wang
  2025-10-21  8:28 ` Michael S. Tsirkin
  2025-10-21 11:17 ` Simon Horman
  0 siblings, 2 replies; 4+ messages in thread
From: Jason Wang @ 2025-10-21  4:01 UTC (permalink / raw)
  To: mst, jasowang, xuanzhuo, eperezma, pabeni, virtualization,
	linux-kernel
  Cc: netdev, stable

When GSO tunnel is negotiated virtio_net_hdr_tnl_from_skb() tries to
initialize the tunnel metadata but forget to zero unused rxhash
fields. This may leak information to another side. Fixing this by
zeroing the unused hash fields.

Fixes: a2fb4bc4e2a6a ("net: implement virtio helpers to handle UDP GSO tunneling")x
Cc: <stable@vger.kernel.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 include/linux/virtio_net.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 20e0584db1dd..4d1780848d0e 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -401,6 +401,10 @@ virtio_net_hdr_tnl_from_skb(const struct sk_buff *skb,
 	if (!tnl_hdr_negotiated)
 		return -EINVAL;
 
+        vhdr->hash_hdr.hash_value = 0;
+        vhdr->hash_hdr.hash_report = 0;
+        vhdr->hash_hdr.padding = 0;
+
 	/* Let the basic parsing deal with plain GSO features. */
 	skb_shinfo(skb)->gso_type &= ~tnl_gso_type;
 	ret = virtio_net_hdr_from_skb(skb, hdr, true, false, vlan_hlen);
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] virtio-net: zero unused hash fields
  2025-10-21  4:01 [PATCH net] virtio-net: zero unused hash fields Jason Wang
@ 2025-10-21  8:28 ` Michael S. Tsirkin
  2025-10-22  3:41   ` Jason Wang
  2025-10-21 11:17 ` Simon Horman
  1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2025-10-21  8:28 UTC (permalink / raw)
  To: Jason Wang
  Cc: xuanzhuo, eperezma, pabeni, virtualization, linux-kernel, netdev,
	stable

On Tue, Oct 21, 2025 at 12:01:55PM +0800, Jason Wang wrote:
> When GSO tunnel is negotiated virtio_net_hdr_tnl_from_skb() tries to
> initialize the tunnel metadata but forget to zero unused rxhash
> fields. This may leak information to another side. Fixing this by
> zeroing the unused hash fields.
> 
> Fixes: a2fb4bc4e2a6a ("net: implement virtio helpers to handle UDP GSO tunneling")x
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  include/linux/virtio_net.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> index 20e0584db1dd..4d1780848d0e 100644
> --- a/include/linux/virtio_net.h
> +++ b/include/linux/virtio_net.h
> @@ -401,6 +401,10 @@ virtio_net_hdr_tnl_from_skb(const struct sk_buff *skb,
>  	if (!tnl_hdr_negotiated)
>  		return -EINVAL;
>  
> +        vhdr->hash_hdr.hash_value = 0;
> +        vhdr->hash_hdr.hash_report = 0;
> +        vhdr->hash_hdr.padding = 0;
> +
>  	/* Let the basic parsing deal with plain GSO features. */
>  	skb_shinfo(skb)->gso_type &= ~tnl_gso_type;
>  	ret = virtio_net_hdr_from_skb(skb, hdr, true, false, vlan_hlen);
> -- 
> 2.42.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] virtio-net: zero unused hash fields
  2025-10-21  4:01 [PATCH net] virtio-net: zero unused hash fields Jason Wang
  2025-10-21  8:28 ` Michael S. Tsirkin
@ 2025-10-21 11:17 ` Simon Horman
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-10-21 11:17 UTC (permalink / raw)
  To: Jason Wang
  Cc: mst, xuanzhuo, eperezma, pabeni, virtualization, linux-kernel,
	netdev, stable

On Tue, Oct 21, 2025 at 12:01:55PM +0800, Jason Wang wrote:
> When GSO tunnel is negotiated virtio_net_hdr_tnl_from_skb() tries to
> initialize the tunnel metadata but forget to zero unused rxhash
> fields. This may leak information to another side. Fixing this by
> zeroing the unused hash fields.
> 
> Fixes: a2fb4bc4e2a6a ("net: implement virtio helpers to handle UDP GSO tunneling")x

nit: there is a stray 'x' at the end of the line above

> Cc: <stable@vger.kernel.org>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  include/linux/virtio_net.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> index 20e0584db1dd..4d1780848d0e 100644
> --- a/include/linux/virtio_net.h
> +++ b/include/linux/virtio_net.h
> @@ -401,6 +401,10 @@ virtio_net_hdr_tnl_from_skb(const struct sk_buff *skb,
>  	if (!tnl_hdr_negotiated)
>  		return -EINVAL;
>  
> +        vhdr->hash_hdr.hash_value = 0;
> +        vhdr->hash_hdr.hash_report = 0;
> +        vhdr->hash_hdr.padding = 0;
> +

nit: The indentation seems off, probably a spaces vs tabs issue

>  	/* Let the basic parsing deal with plain GSO features. */
>  	skb_shinfo(skb)->gso_type &= ~tnl_gso_type;
>  	ret = virtio_net_hdr_from_skb(skb, hdr, true, false, vlan_hlen);
> -- 
> 2.42.0
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] virtio-net: zero unused hash fields
  2025-10-21  8:28 ` Michael S. Tsirkin
@ 2025-10-22  3:41   ` Jason Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2025-10-22  3:41 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: xuanzhuo, eperezma, pabeni, virtualization, linux-kernel, netdev,
	stable

On Tue, Oct 21, 2025 at 4:28 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Tue, Oct 21, 2025 at 12:01:55PM +0800, Jason Wang wrote:
> > When GSO tunnel is negotiated virtio_net_hdr_tnl_from_skb() tries to
> > initialize the tunnel metadata but forget to zero unused rxhash
> > fields. This may leak information to another side. Fixing this by
> > zeroing the unused hash fields.
> >
> > Fixes: a2fb4bc4e2a6a ("net: implement virtio helpers to handle UDP GSO tunneling")x

I just spotted this has an unnecessary trailing 'x'. Will post V2.

> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Jason Wang <jasowang@redhat.com>
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>

Thanks


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-22  3:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21  4:01 [PATCH net] virtio-net: zero unused hash fields Jason Wang
2025-10-21  8:28 ` Michael S. Tsirkin
2025-10-22  3:41   ` Jason Wang
2025-10-21 11:17 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).