SCSI: zfcp: return early from slave_destroy if slave_alloc returned early
commit3b538a7aaf6468c40a1faa559417e6165456b8e3
authorSteffen Maier <maier@linux.vnet.ibm.com>
Fri, 18 Nov 2011 19:00:40 +0000 (18 20:00 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Jan 2012 22:13:47 +0000 (6 14:13 -0800)
tree0ea642cd792b23e8b2425a776b2e322c97a0fb8a
parentcec3c159f674367def095745a72ac6150f889243
SCSI: zfcp: return early from slave_destroy if slave_alloc returned early

commit 44f747fff6e9f027a4866c1a6864e26ae7c510c8 upstream.

zfcp_scsi_slave_destroy erroneously always tried to finish its task
even if the corresponding previous zfcp_scsi_slave_alloc returned
early. This can lead to kernel page faults on accessing uninitialized
fields of struct zfcp_scsi_dev in zfcp_erp_lun_shutdown_wait. Take the
port field of the struct to determine if slave_alloc returned early.

This zfcp bug is exposed by 4e6c82b (in turn fixing f7c9c6b to be
compatible with 21208ae) which can call slave_destroy for a
corresponding previous slave_alloc that did not finish.

This patch is based on James Bottomley's fix suggestion in
http://www.spinics.net/lists/linux-scsi/msg55449.html.

Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/s390/scsi/zfcp_scsi.c