-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1 iQEcBAABAgAGBQJhRE8cAAoJEO8Ells5jWIRY08H/3IZ2sVgJhMUUK1HrMQwF+WX lIEwyNSYI2dlyDtlR0/gJG8jatRa15EW3WVn7ukhlNYWHmLqrRVpteA+xtqsgs8n Mjh/csZqNi2PoC7I6Ec6BxfXE84zinieN+OrxY5Rel0ol6Of5nY1pKZ9Z2nBMR9l 6Z3Ufy6soSMHjSE9PQ2lY5LjjjNLz5HJoL6HRXN/oVF7JHgy9QffZgdgpcwh7djz cCetUjnPIBkk0C59ENM3an872cP6Is/CeUoDXTacukGNWJsJng4YplvJrBy3bU40 tYSBTw98LIi453ppMNKbthM72Jjk6VfQLWtaSWKQfVXEvciGXCKTwbNB7ZWalFY= =fW1/ -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging # gpg: Signature made Fri 17 Sep 2021 09:17:32 BST # gpg: using RSA key EF04965B398D6211 # gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211 * remotes/jasowang/tags/net-pull-request: virtio-net: fix use after unmap/free for sg ebpf: only include in system emulators Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
326ff8dd09
|
@ -1 +1 @@
|
|||
common_ss.add(when: libbpf, if_true: files('ebpf_rss.c'), if_false: files('ebpf_rss-stub.c'))
|
||||
softmmu_ss.add(when: libbpf, if_true: files('ebpf_rss.c'), if_false: files('ebpf_rss-stub.c'))
|
||||
|
|
|
@ -1746,10 +1746,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
|||
VirtIONet *n = qemu_get_nic_opaque(nc);
|
||||
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(n);
|
||||
VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE];
|
||||
size_t lens[VIRTQUEUE_MAX_SIZE];
|
||||
struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
|
||||
struct virtio_net_hdr_mrg_rxbuf mhdr;
|
||||
unsigned mhdr_cnt = 0;
|
||||
size_t offset, i, guest_offset;
|
||||
size_t offset, i, guest_offset, j;
|
||||
ssize_t err;
|
||||
|
||||
if (!virtio_net_can_receive(nc)) {
|
||||
return -1;
|
||||
|
@ -1780,6 +1783,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
|||
|
||||
total = 0;
|
||||
|
||||
if (i == VIRTQUEUE_MAX_SIZE) {
|
||||
virtio_error(vdev, "virtio-net unexpected long buffer chain");
|
||||
err = size;
|
||||
goto err;
|
||||
}
|
||||
|
||||
elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement));
|
||||
if (!elem) {
|
||||
if (i) {
|
||||
|
@ -1791,7 +1800,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
|||
n->guest_hdr_len, n->host_hdr_len,
|
||||
vdev->guest_features);
|
||||
}
|
||||
return -1;
|
||||
err = -1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (elem->in_num < 1) {
|
||||
|
@ -1799,7 +1809,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
|||
"virtio-net receive queue contains no in buffers");
|
||||
virtqueue_detach_element(q->rx_vq, elem, 0);
|
||||
g_free(elem);
|
||||
return -1;
|
||||
err = -1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
sg = elem->in_sg;
|
||||
|
@ -1836,12 +1847,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
|||
if (!n->mergeable_rx_bufs && offset < size) {
|
||||
virtqueue_unpop(q->rx_vq, elem, total);
|
||||
g_free(elem);
|
||||
return size;
|
||||
err = size;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* signal other side */
|
||||
virtqueue_fill(q->rx_vq, elem, total, i++);
|
||||
g_free(elem);
|
||||
elems[i] = elem;
|
||||
lens[i] = total;
|
||||
i++;
|
||||
}
|
||||
|
||||
if (mhdr_cnt) {
|
||||
|
@ -1851,10 +1863,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
|||
&mhdr.num_buffers, sizeof mhdr.num_buffers);
|
||||
}
|
||||
|
||||
for (j = 0; j < i; j++) {
|
||||
/* signal other side */
|
||||
virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
|
||||
g_free(elems[j]);
|
||||
}
|
||||
|
||||
virtqueue_flush(q->rx_vq, i);
|
||||
virtio_notify(vdev, q->rx_vq);
|
||||
|
||||
return size;
|
||||
|
||||
err:
|
||||
for (j = 0; j < i; j++) {
|
||||
g_free(elems[j]);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf,
|
||||
|
|
Loading…
Reference in a new issue