render / rpms / qemu

Forked from rpms/qemu 7 months ago
Clone

Blame 0105-net-ne2000-check-ring-buffer-control-registers.patch

54cb13
From: Prasad J Pandit <pjp@fedoraproject.org>
54cb13
Date: Wed, 24 Feb 2016 11:41:33 +0530
54cb13
Subject: [PATCH] net: ne2000: check ring buffer control registers
54cb13
54cb13
Ne2000 NIC uses ring buffer of NE2000_MEM_SIZE(49152)
54cb13
bytes to process network packets. Registers PSTART & PSTOP
54cb13
define ring buffer size & location. Setting these registers
54cb13
to invalid values could lead to infinite loop or OOB r/w
54cb13
access issues. Add check to avoid it.
54cb13
54cb13
Reported-by: Yang Hongke <yanghongke@huawei.com>
54cb13
Tested-by: Yang Hongke <yanghongke@huawei.com>
54cb13
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
54cb13
Signed-off-by: Jason Wang <jasowang@redhat.com>
54cb13
(cherry picked from commit 415ab35a441eca767d033a2702223e785b9d5190)
54cb13
---
54cb13
 hw/net/ne2000.c | 4 ++++
54cb13
 1 file changed, 4 insertions(+)
54cb13
54cb13
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
54cb13
index a3dffff..995115e 100644
54cb13
--- a/hw/net/ne2000.c
54cb13
+++ b/hw/net/ne2000.c
54cb13
@@ -154,6 +154,10 @@ static int ne2000_buffer_full(NE2000State *s)
54cb13
 {
54cb13
     int avail, index, boundary;
54cb13
 
54cb13
+    if (s->stop <= s->start) {
54cb13
+        return 1;
54cb13
+    }
54cb13
+
54cb13
     index = s->curpag << 8;
54cb13
     boundary = s->boundary << 8;
54cb13
     if (index < boundary)