* [PATCH] Fixed integer overflow in e1000e
@ 2020-03-03 18:29 andrew
2020-03-03 23:41 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: andrew @ 2020-03-03 18:29 UTC (permalink / raw)
To: qemu-devel; +Cc: dmitry.fleytman
From: Andrew Melnychenko <andrew@daynix.com>
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 <andrew@daynix.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fixed integer overflow in e1000e
2020-03-03 18:29 [PATCH] Fixed integer overflow in e1000e andrew
@ 2020-03-03 23:41 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-03 23:41 UTC (permalink / raw)
To: andrew, qemu-devel; +Cc: Jason Wang, dmitry.fleytman
Hi Andrew,
Please Cc all the maintainers:
./scripts/get_maintainer.pl -f hw/net/e1000e.c
Dmitry Fleytman <dmitry.fleytman@gmail.com> (maintainer:e1000e)
Jason Wang <jasowang@redhat.com> (odd fixer:Network devices)
qemu-devel@nongnu.org (open list:All patches CC here)
On 3/3/20 7:29 PM, andrew@daynix.com wrote:
> From: Andrew Melnychenko <andrew@daynix.com>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1737400
The BZ backtrace lists e1000e_tx_pkt_send() which you fixes,
but you also fixes e1000e_start_recv(). Good.
Please include the BZ backtrace.
> 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.
>
Please add:
Cc: qemu-stable@nongnu.org
Fixes: 6f3fbe4ed06
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1737400
> Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
> ---
> 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));
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-03 23:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-03 18:29 [PATCH] Fixed integer overflow in e1000e andrew
2020-03-03 23:41 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).