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