diff options
author | krw <krw@openbsd.org> | 2020-09-08 12:36:42 +0000 |
---|---|---|
committer | krw <krw@openbsd.org> | 2020-09-08 12:36:42 +0000 |
commit | ac22ea1674ea830d3a4271345d5523614cdd4649 (patch) | |
tree | 883baed97b54f8422fabc18201afb719ee5e3a43 /sys/scsi/scsi_base.c | |
parent | Allow -N without a command to change or add a note to an existing key. (diff) | |
download | wireguard-openbsd-ac22ea1674ea830d3a4271345d5523614cdd4649.tar.xz wireguard-openbsd-ac22ea1674ea830d3a4271345d5523614cdd4649.zip |
If SCSI_IGNORE_ILLEGAL_REQUEST is set no error is returned from scsi_xs_sync()
when the request is unsupported.
So check mode sense(6) and mode sense(10) results for valid headers before
passing the results back.
Avoid overwriting any error that was returned.
ok jmatthew@
Diffstat (limited to 'sys/scsi/scsi_base.c')
-rw-r--r-- | sys/scsi/scsi_base.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 00402e42be7..f989c479617 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.274 2020/09/05 14:21:52 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.275 2020/09/08 12:36:42 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -1102,6 +1102,9 @@ scsi_mode_sense(struct scsi_link *link, int pg_code, error = scsi_xs_sync(xs); scsi_xs_put(xs); + if (error == 0 && !VALID_MODE_HDR(&data->hdr)) + error = EIO; + #ifdef SCSIDEBUG sc_print_addr(link); if (error == 0) { @@ -1158,7 +1161,7 @@ scsi_mode_sense_big(struct scsi_link *link, int pg_code, error = scsi_xs_sync(xs); scsi_xs_put(xs); - if (_2btol(data->hdr_big.data_length) < 6) + if (error == 0 && !VALID_MODE_HDR_BIG(&data->hdr_big)) error = EIO; #ifdef SCSIDEBUG |