diff options
author | gibbs <gibbs@FreeBSD.org> | 2004-11-18 04:14:32 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 2004-11-18 04:14:32 +0000 |
commit | fd54e1bc5a6aa8b20229ddc06ec80026792c4d40 (patch) | |
tree | 587c9b1c674fe9993325ea520436fae72551b15a /sys | |
parent | d9d06e648f8fbaad9560af5faa61d028a29c6292 (diff) | |
download | FreeBSD-src-fd54e1bc5a6aa8b20229ddc06ec80026792c4d40.zip FreeBSD-src-fd54e1bc5a6aa8b20229ddc06ec80026792c4d40.tar.gz |
Correct an off-by-one in the calculation of the inquiry buffer length
to request from devices during the "long inquiry" portion of our probe.
This same bug was fixed in the 4.x stream a few years ago, but the fix
was never propogated to -current.
This fix is slightly different than in -stable:
o Use offsetof() instead of a hard coded constant so as the make
the code more self-explainatory.
o Round odd long inquiry lengths up so as to avoid tickling ignore
wide residue bugs in broken parallel SCSI devices running with a
wide transfer negotiation.
MFC: 3 days
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/cam_xpt.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 40833f5..d0b5baf 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -5651,7 +5651,17 @@ probestart(struct cam_periph *periph, union ccb *start_ccb) if (softc->action == PROBE_INQUIRY) inquiry_len = SHORT_INQUIRY_LENGTH; else - inquiry_len = inq_buf->additional_length + 4; + inquiry_len = inq_buf->additional_length + + offsetof(struct scsi_inquiry_data, + additional_length) + 1; + + /* + * Some parallel SCSI devices fail to send an + * ignore wide residue message when dealing with + * odd length inquiry requests. Round up to be + * safe. + */ + inquiry_len = roundup2(inquiry_len, 2); scsi_inquiry(csio, /*retries*/4, |