mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luben Tuikov <ltuikov@yahoo.com>
To: Jack Wang <jack_wang@usish.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"JBottomley@Parallels.com" <JBottomley@Parallels.com>
Subject: Re: [PATCH] [SCSI] libsas: remove expander from dev list on error
Date: Tue, 26 Jul 2011 23:02:07 -0700 (PDT)	[thread overview]
Message-ID: <1311746527.11636.YahooMailNeo@web31811.mail.mud.yahoo.com> (raw)
In-Reply-To: <3B54164438364A3A9A2F19AFF5A4DF0A@usish.com.cn>

----- Original Message -----

> From: Jack Wang <jack_wang@usish.com>
> To: 'Luben Tuikov' <ltuikov@yahoo.com>; 'James Bottomley' <James.Bottomley@suse.de>; linux-kernel@vger.kernel.org; linux-scsi@vger.kernel.org
> Cc: 
> Sent: Tuesday, July 26, 2011 8:26 PM
> Subject: Re: [PATCH] [SCSI] libsas: remove expander from dev list on error
> 
> [PATCH] [SCSI] libsas: remove expander from dev list on error
>> 
>>  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;
>>       }
>>  --
> [Jack Wang] Looks reasonable, thanks for fix this.
> You can add my Reviewed-by: Jack Wang <jack_wang@usish.com> if needed.

Thanks.

Out of curiosity I took a look at my original code from 2005, before Bottomley changed it off git. This bug doesn't happen as the device is added to the port device list only when it is also registered with kobj. I guess that's a moot point now.

    Luben

  parent reply	other threads:[~2011-07-27  6:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2011-07-27  6:10 Luben Tuikov
2011-07-27 20:32 ` Dan Williams
2011-08-31 16:52   ` Luben Tuikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311746527.11636.YahooMailNeo@web31811.mail.mud.yahoo.com \
    --to=ltuikov@yahoo.com \
    --cc=JBottomley@Parallels.com \
    --cc=jack_wang@usish.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®