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