public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Hannes Reinecke <hare@suse.de>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] Sanitize PQ3 device handling (Take #2)
Date: Fri, 10 Jun 2005 16:52:02 -0500	[thread overview]
Message-ID: <1118440323.5031.41.camel@mulgrave> (raw)
In-Reply-To: <4292E4BA.5040001@suse.de>

On Tue, 2005-05-24 at 10:24 +0200, Hannes Reinecke wrote:
> -		printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type);
> +		if (sdev->inq_periph_qual != 1 && sdev->inq_periph_qual != 3)
> +			printk(KERN_INFO "scsi: unknown device type %d\n", sdev->type);

The device type for PQ1 should be reliable, it's only PQ3 that has 0x1f

Also, we have defines for this (SCSI_INQ_PQ_NOT_CON and
SCSI_INQ_PQ_NOT_CAP)

>  	if (res == SCSI_SCAN_LUN_PRESENT) {
> -		if (scsi_report_lun_scan(sdev, bflags, rescan) != 0)
> +		if (scsi_report_lun_scan(sdev, bflags, rescan) != 0) {
>  			/*
>  			 * The REPORT LUN did not scan the target,
>  			 * do a sequential scan.
>  			 */
> +			if (res == SCSI_SCAN_LUN_IGNORED)

This condition is impossible.

> +				/*
> +				 * There's a target here, but lun 0 is not 
> +				 * connected to a device and does not support
> +				 * the report_lun scan.  Fall back to a 
> +				 * sequential lun scan with a bflags of 
> +				 * SPARSELUN.
> +				 *
> +				 * The old code also used a default scsi level
> +				 * of SCSI_2 which seems a bit spurious. Any
> +				 * misbehaving device should rather be added
> +				 * to the blacklist.
> +				 */
> +				bflags |= BLIST_SPARSELUN;

The reason the old code did all that is because the inquiry data of a
PQ3 device isn't credible and shouldn't be acted on.

>  			scsi_sequential_lun_scan(starget, bflags,
>  				       	res, sdev->scsi_level, rescan);

If you really have the SCSI_SCAN_LUN_IGNORED case here, you've already
released sdev in scsi_probe_and_add_lun, so you can't use it here.

Finally, I think you should probably update the scsi_match function not
to attach on PQ3, just in case someone violates spec and has a valid
type.

James



      reply	other threads:[~2005-06-10 21:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-19 14:38 [PATCH] Sanitize PQ3 device handling (Take #2) Hannes Reinecke
2005-05-20 21:40 ` Patrick Mansfield
2005-05-24  8:24   ` Hannes Reinecke
2005-06-10 21:52     ` James Bottomley [this message]

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=1118440323.5031.41.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=hare@suse.de \
    --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