aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_aux.c
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2009-08-18 09:43:06 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 09:49:04 -0400
commita67417ab7eeff45bba55666c0e1083260f3624ee (patch)
tree7f52c070bc9eeb7f5bdbb7f35e26e6ddb2624772 /drivers/s390/scsi/zfcp_aux.c
parentcdf69bb91b0ef14f0e0a987a4430764e6c290644 (diff)
[SCSI] zfcp: invalid usage after free of port resources
In certain error scenarios ports, rports are getting attached, validated and removed from the systems environment. Depending on the layer this occurs asynchronously. This patch fixes the few races which existed and ensures all references and cross references are cleared at the time they're invalid. In addition fc transports actions are only scheduled when required. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 2ccbd185a5fb..fa2460b42298 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -672,12 +672,15 @@ err_out:
672 */ 672 */
673void zfcp_port_dequeue(struct zfcp_port *port) 673void zfcp_port_dequeue(struct zfcp_port *port)
674{ 674{
675 wait_event(port->remove_wq, atomic_read(&port->refcount) == 0);
676 write_lock_irq(&zfcp_data.config_lock); 675 write_lock_irq(&zfcp_data.config_lock);
677 list_del(&port->list); 676 list_del(&port->list);
678 write_unlock_irq(&zfcp_data.config_lock); 677 write_unlock_irq(&zfcp_data.config_lock);
679 if (port->rport) 678 if (port->rport) {
680 port->rport->dd_data = NULL; 679 port->rport->dd_data = NULL;
680 port->rport = NULL;
681 }
682 wait_event(port->remove_wq, atomic_read(&port->refcount) == 0);
683 cancel_work_sync(&port->rport_work); /* usually not necessary */
681 zfcp_adapter_put(port->adapter); 684 zfcp_adapter_put(port->adapter);
682 sysfs_remove_group(&port->sysfs_device.kobj, &zfcp_sysfs_port_attrs); 685 sysfs_remove_group(&port->sysfs_device.kobj, &zfcp_sysfs_port_attrs);
683 device_unregister(&port->sysfs_device); 686 device_unregister(&port->sysfs_device);