[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/13] Fixed integer overflow in e1000e
From: |
Jason Wang |
Subject: |
[PULL 03/13] Fixed integer overflow in e1000e |
Date: |
Fri, 27 Mar 2020 19:13:57 +0800 |
From: Andrew Melnychenko <address@hidden>
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.
Fixes: 6f3fbe4ed06 ("net: Introduce e1000e device emulation")
Signed-off-by: Andrew Melnychenko <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Dmitry Fleytman <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
---
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 a91dbdc..f2cc155 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.5.0
- [PULL 00/13] Net patches, Jason Wang, 2020/03/27
- [PULL 01/13] hw/net/i82596: Correct command bitmask (CID 1419392), Jason Wang, 2020/03/27
- [PULL 02/13] hw/net/i82596.c: Avoid reading off end of buffer in i82596_receive(), Jason Wang, 2020/03/27
- [PULL 03/13] Fixed integer overflow in e1000e,
Jason Wang <=
- [PULL 04/13] hw/net/e1000e_core: Let e1000e_can_receive() return a boolean, Jason Wang, 2020/03/27
- [PULL 05/13] hw/net/smc91c111: Let smc91c111_can_receive() return a boolean, Jason Wang, 2020/03/27
- [PULL 06/13] hw/net/rtl8139: Simplify if/else statement, Jason Wang, 2020/03/27
- [PULL 07/13] hw/net/rtl8139: Update coding style to make checkpatch.pl happy, Jason Wang, 2020/03/27
- [PULL 08/13] hw/net: Make NetCanReceive() return a boolean, Jason Wang, 2020/03/27
- [PULL 09/13] hw/net/can: Make CanBusClientInfo::can_receive() return a boolean, Jason Wang, 2020/03/27
- [PULL 10/13] net/colo-compare.c: Expose "compare_timeout" to users, Jason Wang, 2020/03/27
- [PULL 11/13] net/colo-compare.c: Expose "expired_scan_cycle" to users, Jason Wang, 2020/03/27
- [PULL 12/13] net: tulip: check frame size and r/w data length, Jason Wang, 2020/03/27
- [PULL 13/13] hw/net/allwinner-sun8i-emac.c: Fix REG_ADDR_HIGH/LOW reads, Jason Wang, 2020/03/27