SCSI: zfcp: Bounds checking for deferred error trace
commit6698ed992a57761a1d3583e11e492da6ac3bbdc7
authorSteffen Maier <maier@linux.vnet.ibm.com>
Tue, 4 Sep 2012 13:23:31 +0000 (4 15:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Oct 2012 20:50:22 +0000 (13 05:50 +0900)
tree67ba99a82effe05b02f22c7827a1c9b69c65f9f4
parentf2e388ca8361ca66ed4090e54e287000f9c6e3b4
SCSI: zfcp: Bounds checking for deferred error trace

commit 01e60527f0a49b3d7df603010bd6079bb4b6cf07 upstream.

The pl vector has scount elements, i.e. pl[scount-1] is the last valid
element. For maximum sized requests, payload->counter == scount after
the last loop iteration. Therefore, do bounds checking first (with
boolean shortcut) to not access the invalid element pl[scount].

Do not trust the maximum sbale->scount value from the HBA
but ensure we won't access the pl vector out of our allocated bounds.
While at it, clean up scoping and prevent unnecessary memset.

Minor fix for 86a9668a8d29ea711613e1cb37efa68e7c4db564
"[SCSI] zfcp: support for hardware data router"

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Reviewed-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/scsi/zfcp_dbf.c
drivers/s390/scsi/zfcp_qdio.c