]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
SCSI: ibmvscsi: Fix host config length field overflow
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 30 Jul 2012 01:33:05 +0000 (11:33 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 7 Oct 2012 15:27:26 +0000 (08:27 -0700)
commit 225c56960fcafeccc2b6304f96cd3f0dbf42a16a upstream.

The length field in the host config packet is only 16-bit long, so
passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't
work and result in an empty config from the server.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/ibmvscsi/ibmvscsi.c

index 3d391dc3f11fe7ce8272a85d92968a10cc329b26..36aca4b1ec00d488e1cf4c8badd359ce9677b4b0 100644 (file)
@@ -1547,6 +1547,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
 
        host_config = &evt_struct->iu.mad.host_config;
 
+       /* The transport length field is only 16-bit */
+       length = min(0xffff, length);
+
        /* Set up a lun reset SRP command */
        memset(host_config, 0x00, sizeof(*host_config));
        host_config->common.type = VIOSRP_HOST_CONFIG_TYPE;