summaryrefslogtreecommitdiff
path: root/net/tap-win32.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2021-04-23 11:18:03 +0800
committerPeter Maydell <peter.maydell@linaro.org>2021-04-23 11:11:28 +0100
commitbc38e31b4e0366f3a70c0939abde4c3dd6e0fa30 (patch)
treef8e330e2edb9005a327170cffa51cd0944673806 /net/tap-win32.c
parentb1cffefa1b163bce9aebc3416f562c1d3886eeaa (diff)
net: check the existence of peer before trying to pad
There could be case that peer is NULL. This can happen when during network device hot-add where net device needs to be added first. So the patch check the existence of peer before trying to do the pad. Fixes: 969e50b61a285 ("net: Pad short frames to minimum size before sending from SLiRP/TAP") Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Message-id: 20210423031803.1479-1-jasowang@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net/tap-win32.c')
-rw-r--r--net/tap-win32.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/tap-win32.c b/net/tap-win32.c
index 897bd18e32..6096972f5d 100644
--- a/net/tap-win32.c
+++ b/net/tap-win32.c
@@ -696,7 +696,7 @@ static void tap_win32_send(void *opaque)
if (size > 0) {
orig_buf = buf;
- if (!s->nc.peer->do_not_pad) {
+ if (net_peer_needs_padding(&s->nc)) {
if (eth_pad_short_frame(min_pkt, &min_pktsz, buf, size)) {
buf = min_pkt;
size = min_pktsz;