]> git.proxmox.com Git - mirror_qemu.git/commitdiff
dma: rc4030: limit interval timer reload value
authorPrasad J Pandit <pjp@fedoraproject.org>
Wed, 12 Oct 2016 12:37:41 +0000 (18:07 +0530)
committerYongbok Kim <yongbok.kim@imgtec.com>
Mon, 20 Mar 2017 11:19:55 +0000 (11:19 +0000)
The JAZZ RC4030 chipset emulator has a periodic timer and
associated interval reload register. The reload value is used
as divider when computing timer's next tick value. If reload
value is large, it could lead to divide by zero error. Limit
the interval reload value to avoid it.

Reported-by: Huawei PSIRT <psirt@huawei.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
hw/dma/rc4030.c

index 17c8518feafb0c3e281ac691e05a5223fc72a095..41fc0434642bb828738fff4e48b8ba02a4903145 100644 (file)
@@ -460,7 +460,7 @@ static void rc4030_write(void *opaque, hwaddr addr, uint64_t data,
         break;
     /* Interval timer reload */
     case 0x0228:
-        s->itr = val;
+        s->itr = val & 0x01FF;
         qemu_irq_lower(s->timer_irq);
         set_next_tick(s);
         break;