scsi: fail invalid MODE_SELECT requests
For MODE_SELECT request we didn't verify the parameter list length field from CDB and could complete an invalid I/O without reporting any error. Fix it by adding an additional check. Just to clarify: the I/O did not do any harm, we just completed it with success while we should have completed it with some error status. Change-Id: I473e321da37259ee6318ca7dadab2726851d2b68 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463065 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
1aa34d2361
commit
bcb9d9361a
@ -1779,14 +1779,9 @@ bdev_scsi_process_primary(struct spdk_scsi_task *task)
|
||||
if (rc < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
data_len = rc;
|
||||
if (cdb[0] == SPDK_SPC_MODE_SELECT_6) {
|
||||
rc = bdev_scsi_check_len(task, data_len, 4);
|
||||
} else {
|
||||
rc = bdev_scsi_check_len(task, data_len, 8);
|
||||
}
|
||||
|
||||
rc = bdev_scsi_check_len(task, data_len, spdk_max(pllen, md));
|
||||
if (rc < 0) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user