Skip to content

Commit

Permalink
[SCSI] sd: fix USB devices incorrectly reporting DIF support
Browse files Browse the repository at this point in the history
Some USB devices set the protect bit in the INQUIRY data which
currently causes the DIF code in sd to assume (incorrectly) that they
support READ_CAPACITY(16).  Fix this (only for the time being) by
making sure we only believe the protect bit in the inquiry data if the
device claims conformance to SCSI-3 or above.

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
Hugh Dickins authored and James Bottomley committed Aug 6, 2008
1 parent 0967d61 commit d211f05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/scsi/scsi_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/blkdev.h>
#include <scsi/scsi.h>
#include <asm/atomic.h>

struct request_queue;
Expand Down Expand Up @@ -426,7 +427,7 @@ static inline int scsi_device_enclosure(struct scsi_device *sdev)

static inline int scsi_device_protection(struct scsi_device *sdev)
{
return sdev->inquiry[5] & (1<<0);
return sdev->scsi_level > SCSI_2 && sdev->inquiry[5] & (1<<0);
}

#define MODULE_ALIAS_SCSI_DEVICE(type) \
Expand Down

0 comments on commit d211f05

Please sign in to comment.