chengshan / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
a8a466
centosplus kernel patch [bug#12841]
a8a466
a8a466
commit b0120d9906253570f593daf82016a5331bbee2b8
a8a466
Author: Cathy Avery <cavery@redhat.com>
a8a466
Date:   Wed Nov 23 08:46:33 2016 -0500
a8a466
a8a466
    scsi: storvsc: Payload buffer incorrectly sized for 32 bit kernels.
a8a466
    
a8a466
    On a 32 bit kernel sizeof(void *) is not 64 bits as hv_mpb_array
a8a466
    requires. Also the buffer needs to be cleared or the upper bytes will
a8a466
    contain junk.
a8a466
    
a8a466
    Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
a8a466
    Signed-off-by: Cathy Avery <cavery@redhat.com>
a8a466
    Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
a8a466
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
a8a466
a8a466
    Applied-by: Akemi Yagi <toracat@centos.org>
a8a466
a8a466
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
a8a466
index 8ccfc9e..05526b7 100644
a8a466
--- a/drivers/scsi/storvsc_drv.c
a8a466
+++ b/drivers/scsi/storvsc_drv.c
a8a466
@@ -1495,9 +1495,9 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
a8a466
 	if (sg_count) {
a8a466
 		if (sg_count > MAX_PAGE_BUFFER_COUNT) {
a8a466
 
a8a466
-			payload_sz = (sg_count * sizeof(void *) +
a8a466
+			payload_sz = (sg_count * sizeof(u64) +
a8a466
 				      sizeof(struct vmbus_packet_mpb_array));
a8a466
-			payload = kmalloc(payload_sz, GFP_ATOMIC);
a8a466
+			payload = kzalloc(payload_sz, GFP_ATOMIC);
a8a466
 			if (!payload)
a8a466
 				return SCSI_MLQUEUE_DEVICE_BUSY;
a8a466
 		}