net: Check if nc is NULL in qemu_get_vnet_hdr_len()
PATCH 1/1 net: Check if nc is NULL in qemu_get_vnet_hdr_len()
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.
--- net/net.c | 4 ++++ 1 file changed, 4 insertions(+)
net/net.c +4 -0
@@ -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,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 7 lines · On Sat, 17 Aug 2024 16:00:43 +0900 Akihiko Odaki <[email protected]>…
A netdev may not have a peer specified, resulting in NULL. We should make it behave like
/dev/nullin such a case instead of letting it cause segmentatin fault.Fixes 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")Reported-by Jonathan Cameron <[email protected]>Signed-off-by Akihiko Odaki <[email protected]>
FWIW fixed my issue. I'd forgotten about but noticed that it was still in my tree after a rebase.
Tested-by; Jonathan Cameron <[email protected]>
Quoted 25 lines
--- net/net.c | 4 ++++ 1 file changed, 4 insertions(+)net/net.c +4
-1@@ -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-dc461895a295Best regards,
Quoted 3 lines · Akihiko Odaki
A netdev may not have a peer specified, resulting in NULL. We should make it behave like
/dev/nullin such a case instead of letting it cause segmentatin fault.
segmentation
Quoted 4 lines
Fixes 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")Reported-by Jonathan Cameron <[email protected]>Signed-off-by Akihiko Odaki <[email protected]>
Jason, you tree?
Quoted 27 lines
--- net/net.c | 4 ++++ 1 file changed, 4 insertions(+)net/net.c +4
-1@@ -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-dc461895a295Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 9 lines · Michael S. Tsirkin
Quoted 3 lines · Akihiko Odaki
A netdev may not have a peer specified, resulting in NULL. We should make it behave like
/dev/nullin such a case instead of letting it cause segmentatin fault.segmentation
Quoted 1 line
Quoted 9 lines
Quoted 3 lines
Fixes 4b52d63249a5 ("tap: Remove qemu_using_vnet_hdr()")Reported-by Jonathan Cameron <[email protected]>Signed-off-by Akihiko Odaki <[email protected]>Jason, you tree?
Yes.
Queued.
Thanks
Quoted 5 lines · Akihiko Odaki
A netdev may not have a peer specified, resulting in NULL. We should make it behave like
/dev/nullin 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