qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len()
@ 2024-08-17  7:00 Akihiko Odaki
  2024-10-10 16:36 ` Jonathan Cameron via
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Akihiko Odaki @ 2024-08-17  7:00 UTC (permalink / raw)
  To: Jason Wang
  Cc: Dmitry Fleytman, Sriram Yagnaraman, Michael S. Tsirkin,
	Luigi Rizzo, Giuseppe Lettieri, Vincenzo Maffione,
	Andrew Melnychenko, Yuri Benditovich, qemu-devel,
	Jonathan Cameron, Akihiko Odaki

A netdev may not have a peer specified, resulting in NULL. We should
make it behave like /dev/null in such a case instead of letting it
cause segmentatin fault.

Fixes: 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")
Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 net/net.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/net.c b/net/net.c
index 6938da05e077..4c21d91f9450 100644
--- a/net/net.c
+++ b/net/net.c
@@ -542,6 +542,10 @@ void qemu_set_offload(NetClientState *nc, int csum, int tso4, int tso6,
 
 int qemu_get_vnet_hdr_len(NetClientState *nc)
 {
+    if (!nc) {
+        return 0;
+    }
+
     return nc->vnet_hdr_len;
 }
 

---
base-commit: 31669121a01a14732f57c49400bc239cf9fd505f
change-id: 20240817-net-dc461895a295

Best regards,
-- 
Akihiko Odaki <akihiko.odaki@daynix.com>



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

* Re: [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len()
  2024-08-17  7:00 [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len() Akihiko Odaki
@ 2024-10-10 16:36 ` Jonathan Cameron via
  2024-10-11  5:55 ` Michael S. Tsirkin
  2024-10-18 18:34 ` Michael Tokarev
  2 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron via @ 2024-10-10 16:36 UTC (permalink / raw)
  To: Akihiko Odaki
  Cc: Jason Wang, Dmitry Fleytman, Sriram Yagnaraman,
	Michael S. Tsirkin, Luigi Rizzo, Giuseppe Lettieri,
	Vincenzo Maffione, Andrew Melnychenko, Yuri Benditovich,
	qemu-devel

On Sat, 17 Aug 2024 16:00:43 +0900
Akihiko Odaki <akihiko.odaki@daynix.com> wrote:

> A netdev may not have a peer specified, resulting in NULL. We should
> make it behave like /dev/null in such a case instead of letting it
> cause segmentatin fault.
> 
> Fixes: 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")
> Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>

FWIW fixed my issue. I'd forgotten about but noticed that
it was still in my tree after a rebase.

Tested-by; Jonathan Cameron <Jonathan.Cameron@huawei.com>


> ---
>  net/net.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/net.c b/net/net.c
> index 6938da05e077..4c21d91f9450 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -542,6 +542,10 @@ void qemu_set_offload(NetClientState *nc, int csum, int tso4, int tso6,
>  
>  int qemu_get_vnet_hdr_len(NetClientState *nc)
>  {
> +    if (!nc) {
> +        return 0;
> +    }
> +
>      return nc->vnet_hdr_len;
>  }
>  
> 
> ---
> base-commit: 31669121a01a14732f57c49400bc239cf9fd505f
> change-id: 20240817-net-dc461895a295
> 
> Best regards,



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

* Re: [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len()
  2024-08-17  7:00 [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len() Akihiko Odaki
  2024-10-10 16:36 ` Jonathan Cameron via
@ 2024-10-11  5:55 ` Michael S. Tsirkin
  2024-10-18  8:11   ` Jason Wang
  2024-10-18 18:34 ` Michael Tokarev
  2 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2024-10-11  5:55 UTC (permalink / raw)
  To: Akihiko Odaki
  Cc: Jason Wang, Dmitry Fleytman, Sriram Yagnaraman, Luigi Rizzo,
	Giuseppe Lettieri, Vincenzo Maffione, Andrew Melnychenko,
	Yuri Benditovich, qemu-devel, Jonathan Cameron

On Sat, Aug 17, 2024 at 04:00:43PM +0900, Akihiko Odaki wrote:
> A netdev may not have a peer specified, resulting in NULL. We should
> make it behave like /dev/null in such a case instead of letting it
> cause segmentatin fault.

segmentation

> 
> Fixes: 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")
> Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>


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

Jason, you tree?

> ---
>  net/net.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/net.c b/net/net.c
> index 6938da05e077..4c21d91f9450 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -542,6 +542,10 @@ void qemu_set_offload(NetClientState *nc, int csum, int tso4, int tso6,
>  
>  int qemu_get_vnet_hdr_len(NetClientState *nc)
>  {
> +    if (!nc) {
> +        return 0;
> +    }
> +
>      return nc->vnet_hdr_len;
>  }
>  
> 
> ---
> base-commit: 31669121a01a14732f57c49400bc239cf9fd505f
> change-id: 20240817-net-dc461895a295
> 
> Best regards,
> -- 
> Akihiko Odaki <akihiko.odaki@daynix.com>



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

* Re: [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len()
  2024-10-11  5:55 ` Michael S. Tsirkin
@ 2024-10-18  8:11   ` Jason Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2024-10-18  8:11 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Akihiko Odaki, Dmitry Fleytman, Sriram Yagnaraman, Luigi Rizzo,
	Giuseppe Lettieri, Vincenzo Maffione, Andrew Melnychenko,
	Yuri Benditovich, qemu-devel, Jonathan Cameron

On Fri, Oct 11, 2024 at 1:55 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Sat, Aug 17, 2024 at 04:00:43PM +0900, Akihiko Odaki wrote:
> > A netdev may not have a peer specified, resulting in NULL. We should
> > make it behave like /dev/null in such a case instead of letting it
> > cause segmentatin fault.
>
> segmentation
>
> >
> > Fixes: 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")
> > Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
>
> Jason, you tree?
>

Yes.

Queued.

Thanks



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

* Re: [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len()
  2024-08-17  7:00 [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len() Akihiko Odaki
  2024-10-10 16:36 ` Jonathan Cameron via
  2024-10-11  5:55 ` Michael S. Tsirkin
@ 2024-10-18 18:34 ` Michael Tokarev
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2024-10-18 18:34 UTC (permalink / raw)
  To: Akihiko Odaki, Jason Wang
  Cc: Dmitry Fleytman, Sriram Yagnaraman, Michael S. Tsirkin,
	Luigi Rizzo, Giuseppe Lettieri, Vincenzo Maffione,
	Andrew Melnychenko, Yuri Benditovich, qemu-devel,
	Jonathan Cameron, qemu-stable

17.08.2024 10:00, Akihiko Odaki wrote:
> A netdev may not have a peer specified, resulting in NULL. We should
> make it behave like /dev/null in such a case instead of letting it
> cause segmentatin fault.
> 
> Fixes: 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")

Feels like qemu-stable material (Cc'd).

/mjt



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

end of thread, other threads:[~2024-10-18 18:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-17  7:00 [PATCH] net: Check if nc is NULL in qemu_get_vnet_hdr_len() Akihiko Odaki
2024-10-10 16:36 ` Jonathan Cameron via
2024-10-11  5:55 ` Michael S. Tsirkin
2024-10-18  8:11   ` Jason Wang
2024-10-18 18:34 ` Michael Tokarev

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).