public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: crash in pscsi_get_device_type
Date: Wed, 4 Mar 2015 16:00:04 +0100	[thread overview]
Message-ID: <20150304150004.GA22266@aepfle.de> (raw)
In-Reply-To: <1425037939.30824.89.camel@haakon3.risingtidesystems.com>

On Fri, Feb 27, Nicholas A. Bellinger wrote:

> On Thu, 2015-02-26 at 10:26 +0100, Olaf Hering wrote:

> > [  145.661468] IP: [<ffffffffa024f17b>] pscsi_get_device_type+0xb/0x20 [target_core_pscsi]
> Looks like a PSCSI specific NULL pointer dereference when reading the
> dev_type attribute if a backend device was not able to be successfully
> configured -> enabled.
> 
> Here's a quick patch to address this case.  Please confirm on your end.

Unfortunately I can not reproduce it anymore. Maybe it depends on the .config?

Olaf

> diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
> index 1045dcd..f6c954c 100644
> --- a/drivers/target/target_core_pscsi.c
> +++ b/drivers/target/target_core_pscsi.c
> @@ -1121,7 +1121,7 @@ static u32 pscsi_get_device_type(struct se_device *dev)
>         struct pscsi_dev_virt *pdv = PSCSI_DEV(dev);
>         struct scsi_device *sd = pdv->pdv_sd;
>  
> -       return sd->type;
> +       return (sd) ? sd->type : TYPE_NO_LUN;
>  }
>  
>  static sector_t pscsi_get_blocks(struct se_device *dev)

  reply	other threads:[~2015-03-04 15:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26  9:26 crash in pscsi_get_device_type Olaf Hering
2015-02-27 11:52 ` Nicholas A. Bellinger
2015-03-04 15:00   ` Olaf Hering [this message]
2015-03-05  3:56     ` Nicholas A. Bellinger

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=20150304150004.GA22266@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@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