[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/14] net: Check if nc is NULL in qemu_get_vnet_hdr_len()
From: |
Jason Wang |
Subject: |
[PULL 12/14] net: Check if nc is NULL in qemu_get_vnet_hdr_len() |
Date: |
Tue, 29 Oct 2024 16:07:03 +0800 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
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()")
Cc: qemu-stable@nongnu.org
Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Tested-by; Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
net/net.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/net.c b/net/net.c
index d9b23a8f8c..7ef6885876 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;
}
--
2.42.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PULL 12/14] net: Check if nc is NULL in qemu_get_vnet_hdr_len(),
Jason Wang <=