mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-20 14:16:31 +00:00
scst_vdisk, MODE SELECT(10): Interpret both bytes of the BLOCK DESCRIPTOR LENGTH field
While the BLOCK DESCRIPTOR LENGTH field spans a single byte in the Mode parameter header(6), the size of this field in the Mode parameter header(10) is two bytes. Interpret both bytes while executing a MODE SELECT(10) command. Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5849 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -4351,7 +4351,7 @@ static enum compl_status_e vdisk_exec_mode_select(struct vdisk_cmd_params *p)
|
||||
int32_t length;
|
||||
uint8_t *address;
|
||||
struct scst_vdisk_dev *virt_dev;
|
||||
int mselect_6, offset, type;
|
||||
int mselect_6, offset, bdl, type;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
@@ -4370,14 +4370,17 @@ static enum compl_status_e vdisk_exec_mode_select(struct vdisk_cmd_params *p)
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
if (mselect_6)
|
||||
if (mselect_6) {
|
||||
bdl = address[3];
|
||||
offset = 4;
|
||||
else
|
||||
} else {
|
||||
bdl = get_unaligned_be16(&address[6]);
|
||||
offset = 8;
|
||||
}
|
||||
|
||||
if (address[offset - 1] == 8) {
|
||||
if (bdl == 8)
|
||||
offset += 8;
|
||||
} else if (address[offset - 1] != 0) {
|
||||
else if (bdl != 0) {
|
||||
PRINT_ERROR("%s", "MODE SELECT: Wrong parameters list length");
|
||||
scst_set_invalid_field_in_parm_list(cmd, offset-1, 0);
|
||||
goto out_put;
|
||||
|
||||
Reference in New Issue
Block a user