mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [SCSI] libsas: remove expander from dev list on error
@ 2011-07-27  6:10 Luben Tuikov
  2011-07-27 20:32 ` Dan Williams
  0 siblings, 1 reply; 7+ messages in thread
From: Luben Tuikov @ 2011-07-27  6:10 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, JBottomley, Jack Wang

If expander discovery fails (sas_discover_expander()),
remove the expander from the port device list
(sas_ex_discover_expander()), before freeing it. Else
the list is corrupted and, e.g., when we attempt to send
SMP commands to other devices, the kernel oopses.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Reviewed-by: Jack Wang <jack_wang@usish.com>
---
 drivers/scsi/libsas/sas_expander.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 874e29d..f84084b 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -849,6 +849,9 @@ static struct domain_device *sas_ex_discover_expander(
 
        res = sas_discover_expander(child);
        if (res) {
+               spin_lock_irq(&parent->port->dev_list_lock);
+               list_del(&child->dev_list_node);
+               spin_unlock_irq(&parent->port->dev_list_lock);
                kfree(child);
                return NULL;
        }
-- 
1.7.2.2.165.gbc382

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] [SCSI] libsas: remove expander from dev list on error
@ 2011-07-27  3:09 Luben Tuikov
  2011-07-27  3:26 ` Jack Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Luben Tuikov @ 2011-07-27  3:09 UTC (permalink / raw)
  To: James Bottomley, linux-kernel, linux-scsi

If expander discovery fails (sas_discover_expander()),
remove the expander from the port device list
(sas_ex_discover_expander()), before freeing it. Else
the list is corrupted and, e.g., when we attempt to send
SMP commands to other devices, the kernel oopses.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 drivers/scsi/libsas/sas_expander.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 874e29d..f84084b 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -849,6 +849,9 @@ static struct domain_device *sas_ex_discover_expander(
 
     res = sas_discover_expander(child);
     if (res) {
+        spin_lock_irq(&parent->port->dev_list_lock);
+        list_del(&child->dev_list_node);
+        spin_unlock_irq(&parent->port->dev_list_lock);
         kfree(child);
         return NULL;
     }
-- 
1.7.2.2.165.gbc382

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

end of thread, other threads:[~2011-08-31 16:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-27  6:10 [PATCH] [SCSI] libsas: remove expander from dev list on error Luben Tuikov
2011-07-27 20:32 ` Dan Williams
2011-08-31 16:52   ` Luben Tuikov
  -- strict thread matches above, loose matches on Subject: below --
2011-07-27  3:09 Luben Tuikov
2011-07-27  3:26 ` Jack Wang
2011-07-27  4:59   ` Luben Tuikov
2011-07-27  6:02   ` Luben Tuikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®