qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] Fixed integer overflow in e1000e


From: Jason Wang
Subject: Re: [PATCH v2] Fixed integer overflow in e1000e
Date: Tue, 17 Mar 2020 14:18:51 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0


On 2020/3/5 下午5:17, Dmitry Fleytman wrote:

On 4 Mar 2020, at 16:20, address@hidden wrote:

From: Andrew Melnychenko <address@hidden>

Fixes: 6f3fbe4ed06
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1737400
Fixed setting max_queue_num if there are no peers in NICConf. qemu_new_nic() 
creates NICState with 1 NetClientState(index 0) without peers, set 
max_queue_num to 0 - It prevents undefined behavior and possible crashes, 
especially during pcie hotplug.

Signed-off-by: Andrew Melnychenko <address@hidden>
Reviewed-by: Dmitry Fleytman <address@hidden>


Applied.

Thanks



---
hw/net/e1000e.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index a91dbdca3c..f2cc1552c5 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -328,7 +328,7 @@ e1000e_init_net_peer(E1000EState *s, PCIDevice *pci_dev, 
uint8_t *macaddr)
     s->nic = qemu_new_nic(&net_e1000e_info, &s->conf,
         object_get_typename(OBJECT(s)), dev->id, s);

-    s->core.max_queue_num = s->conf.peers.queues - 1;
+    s->core.max_queue_num = s->conf.peers.queues ? s->conf.peers.queues - 1 : 
0;

     trace_e1000e_mac_set_permanent(MAC_ARG(macaddr));
     memcpy(s->core.permanent_mac, macaddr, sizeof(s->core.permanent_mac));
--
2.24.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]