render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame 0014-scsi-megasas-use-appropriate-property-buffer-size.patch

cf91b1
From: Prasad J Pandit <pjp@fedoraproject.org>
cf91b1
Date: Wed, 25 May 2016 16:01:29 +0530
cf91b1
Subject: [PATCH] scsi: megasas: use appropriate property buffer size
cf91b1
cf91b1
When setting MegaRAID SAS controller properties via MegaRAID
cf91b1
Firmware Interface(MFI) commands, a user supplied size parameter
cf91b1
is used to set property value. Use appropriate size value to avoid
cf91b1
OOB access issues.
cf91b1
cf91b1
Reported-by: Li Qiang <liqiang6-s@360.cn>
cf91b1
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
cf91b1
Message-Id: <1464172291-2856-2-git-send-email-ppandit@redhat.com>
cf91b1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cf91b1
(cherry picked from commit 1b85898025c4cd95dce673d15e67e60e98e91731)
cf91b1
---
cf91b1
 hw/scsi/megasas.c | 2 +-
cf91b1
 1 file changed, 1 insertion(+), 1 deletion(-)
cf91b1
cf91b1
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
cf91b1
index a63a581..dcbd3e1 100644
cf91b1
--- a/hw/scsi/megasas.c
cf91b1
+++ b/hw/scsi/megasas.c
cf91b1
@@ -1446,7 +1446,7 @@ static int megasas_dcmd_set_properties(MegasasState *s, MegasasCmd *cmd)
cf91b1
                                             dcmd_size);
cf91b1
         return MFI_STAT_INVALID_PARAMETER;
cf91b1
     }
cf91b1
-    dma_buf_write((uint8_t *)&info, cmd->iov_size, &cmd->qsg);
cf91b1
+    dma_buf_write((uint8_t *)&info, dcmd_size, &cmd->qsg);
cf91b1
     trace_megasas_dcmd_unsupported(cmd->index, cmd->iov_size);
cf91b1
     return MFI_STAT_OK;
cf91b1
 }