[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.0] virtio-net: fix guest-triggerable buffe
From: |
Alin Dobre |
Subject: |
Re: [Qemu-devel] [PATCH for-2.0] virtio-net: fix guest-triggerable buffer overrun |
Date: |
Tue, 22 Apr 2014 14:43:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
Hello,
For the 1.6 branch, is this as straight forward as the following diff,
or is there anything I'm missing?
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 5320aab..a42d241 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -655,7 +655,7 @@ static int virtio_net_handle_mac(VirtIONet *n,
uint8_t cmd,
goto error;
}
- if (n->mac_table.in_use + mac_data.entries <= MAC_TABLE_ENTRIES) {
+ if (mac_data.entries <= MAC_TABLE_ENTRIES - n->mac_table.in_use) {
s = iov_to_buf(iov, iov_cnt, 0, n->mac_table.macs,
mac_data.entries * ETH_ALEN);
if (s != mac_data.entries * ETH_ALEN) {
Cheers,
Alin.