]> git.kernelconcepts.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)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 24 Sep 2012 08:11:09 +0000 (12:11 +0400)
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>
Cc: <stable@vger.kernel.org>
Acked-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/ibmvscsi/ibmvscsi.c

index a8462176ee57f1d85a6c350466c0e6817d1a447b..ef9a54c7da6730b2f7ff9fc07a6037f12fb02a96 100644 (file)
@@ -1851,6 +1851,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;