aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Qiang <liqiang6-s@360.cn>2016-09-12 18:14:11 +0530
committerMichael Roth <mdroth@linux.vnet.ibm.com>2016-11-02 16:41:34 -0500
commitc6a7b922f8ab4af286da90124b1669e9b553e957 (patch)
tree5138531ec9383f8e3c20a8f2ded382f6b11c6813
parentd06c61f31001474a73b7fcc7a2c2067ed3f489d4 (diff)
scsi: mptsas: use g_new0 to allocate MPTSASRequest object
When processing IO request in mptsas, it uses g_new to allocate a 'req' object. If an error occurs before 'req->sreq' is allocated, It could lead to an OOB write in mptsas_free_request function. Use g_new0 to avoid it. Reported-by: Li Qiang <liqiang6-s@360.cn> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-Id: <1473684251-17476-1-git-send-email-ppandit@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 670e56d3ed2918b3861d9216f2c0540d9e9ae0d5) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--hw/scsi/mptsas.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index 0e0a22f696..eaae1bb182 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -304,7 +304,7 @@ static int mptsas_process_scsi_io_request(MPTSASState *s,
goto bad;
}
- req = g_new(MPTSASRequest, 1);
+ req = g_new0(MPTSASRequest, 1);
QTAILQ_INSERT_TAIL(&s->pending, req, next);
req->scsi_io = *scsi_io;
req->dev = s;