We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c6603e commit e0a2c28Copy full SHA for e0a2c28
drivers/scsi/scsi_debug.c
@@ -2502,11 +2502,11 @@ static int resp_mode_select(struct scsi_cmnd *scp,
2502
__func__, param_len, res);
2503
md_len = mselect6 ? (arr[0] + 1) : (get_unaligned_be16(arr + 0) + 2);
2504
bd_len = mselect6 ? arr[3] : get_unaligned_be16(arr + 6);
2505
- if (md_len > 2) {
+ off = bd_len + (mselect6 ? 4 : 8);
2506
+ if (md_len > 2 || off >= res) {
2507
mk_sense_invalid_fld(scp, SDEB_IN_DATA, 0, -1);
2508
return check_condition_result;
2509
}
- off = bd_len + (mselect6 ? 4 : 8);
2510
mpage = arr[off] & 0x3f;
2511
ps = !!(arr[off] & 0x80);
2512
if (ps) {
0 commit comments