diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-09-15 15:00:31 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-09-15 15:00:31 +0000 |
commit | da49df4f7481492e45248dacc78c57b9e823cdf6 (patch) | |
tree | 7e55c3b3bd4b6769e69b623e95f963b0295eaa59 /sys/scsi | |
parent | 3c0e6976edfa9038cd3b6deac253c858d0237237 (diff) |
With the recent fixes to SCSI version detection we reproduced a
problem encountered by FreeBSD and Linux when they started to try
issuing READ CAPACITY 16 commands to 'newer' devices. i.e. some USB
devices return bad data instead of an error when they can't handle the
command.
Reproduce the FreeBSD solution (r233746 by mav@) by issuing READ
CAPACITY 16 commands only to devices that claim to be REALLY new
(a.k.a. newer than SPC-2, a.k.a. newer than SCSI-3), or which indicate
they really are bigger than can be reported via READ CAPACITY 10.
Should fix some USB devices claiming to have 71,776,119,061,217,281 or
33,601,071,049,867,265 sectors.
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/sd.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 92e22c1b1ba..b867ef92df5 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.280 2019/09/14 13:30:48 krw Exp $ */ +/* $OpenBSD: sd.c,v 1.281 2019/09/15 15:00:30 krw Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -1537,13 +1537,13 @@ sd_size(struct sd_softc *sc, int flags) return (ENXIO); /* - * post-SPC (i.e. post-SCSI-3)) devices can start with 16 byte - * read capacity commands. Older devices start with then 10 byte + * post-SPC2 (i.e. post-SCSI-3) devices can start with 16 byte + * read capacity commands. Older devices start with the 10 byte * version and move up to the 16 byte version if the device * says it has more sectors than can be reported via the 10 byte * read capacity. */ - if (SID_ANSII_REV(&sc->sc_link->inqdata) >= SCSI_REV_SPC) { + if (SID_ANSII_REV(&sc->sc_link->inqdata) > SCSI_REV_SPC2) { rv = sd_read_cap_16(sc, flags); if (rv != 0) rv = sd_read_cap_10(sc, flags); |