qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 3/3] ppc/pnv: check size before data buffer access
@ 2018-10-22 12:19 P J P
  2018-10-23 15:37 ` David Gibson
  0 siblings, 1 reply; 6+ messages in thread
From: P J P @ 2018-10-22 12:19 UTC (permalink / raw)
  To: Qemu Developers; +Cc: Alexander Graf, David Gibson, Moguofang, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

While performing PowerNV memory r/w operations, the access length
'sz' could exceed the data[4] buffer size. Add check to avoid OOB
access.

Reported-by: Moguofang <moguofang@huawei.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 hw/ppc/pnv_lpc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
index d7721320a2..f5e5bd4053 100644
--- a/hw/ppc/pnv_lpc.c
+++ b/hw/ppc/pnv_lpc.c
@@ -158,6 +158,10 @@ static void pnv_lpc_do_eccb(PnvLpcController *lpc, uint64_t cmd)
     uint8_t data[4];
     bool success;
 
+    if (sz > sizeof(data)) {
+        return;
+    }
+
     if (cmd & ECCB_CTL_READ) {
         success = opb_read(lpc, opb_addr, data, sz);
         if (success) {
-- 
2.17.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-26  9:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-22 12:19 [Qemu-devel] [PATCH 3/3] ppc/pnv: check size before data buffer access P J P
2018-10-23 15:37 ` David Gibson
2018-10-24 17:03   ` Cédric Le Goater
2018-10-25  6:45     ` P J P
2018-10-26  8:25       ` Cédric Le Goater
2018-10-26  9:38         ` P J P

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).