All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cleanup after a discovery error
@ 2006-10-19  3:19 malahal
  2006-10-19 19:08 ` James Bottomley
  0 siblings, 1 reply; 4+ messages in thread
From: malahal @ 2006-10-19  3:19 UTC (permalink / raw)
  To: linux-scsi

Domain device is freed but the port dev list is not adjusted on some
discovery errors. Module unload will Oops if this happens.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>

diff -r 4e1720b3c71b drivers/scsi/libsas/sas_discover.c
--- a/drivers/scsi/libsas/sas_discover.c	Thu Oct 05 10:02:13 2006 -0700
+++ b/drivers/scsi/libsas/sas_discover.c	Fri Oct 13 19:58:54 2006 -0700
@@ -684,7 +684,23 @@ static void sas_discover_domain(void *da
 	}
 
 	if (error) {
-		kfree(port->port_dev); /* not kobject_register-ed yet */
+		struct domain_device *dev = port->port_dev;
+		
+		if (dev->rphy) {
+			sas_remove_children(&dev->rphy->dev);
+			sas_rphy_delete(dev->rphy);
+			dev->rphy = NULL;
+		}
+		if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV) {
+			if (dev->ex_dev.ex_phy) {
+				kfree(dev->ex_dev.ex_phy);
+				dev->ex_dev.ex_phy = NULL;
+			}
+		}
+		spin_lock(&port->dev_list_lock);
+		list_del_init(&dev->dev_list_node);
+		spin_unlock(&port->dev_list_lock);
+		kfree(dev); /* not kobject_register-ed yet */
 		port->port_dev = NULL;
 	}
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-11-07 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-19  3:19 [PATCH] cleanup after a discovery error malahal
2006-10-19 19:08 ` James Bottomley
2006-10-30 20:23   ` malahal
2006-11-07 20:01     ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.