Commit 6a16d7be932a9df1024836ccbb448de73afd3dd0
Committed by
Nicholas Bellinger
1 parent
2d15025a56
Exists in
master
and in
16 other branches
target: Fix missing length check in spc_emulate_evpd_83()
Commit fbfe858fea2a ("target_core_spc: Include target device descriptor in VPD page 83") added a new length variable, but (due to a cut and paste mistake?) just checks scsi_name_len against 256 twice. Fix this to check scsi_target_len for overflow too. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
drivers/target/target_core_spc.c
... | ... | @@ -440,8 +440,8 @@ |
440 | 440 | padding = ((-scsi_target_len) & 3); |
441 | 441 | if (padding) |
442 | 442 | scsi_target_len += padding; |
443 | - if (scsi_name_len > 256) | |
444 | - scsi_name_len = 256; | |
443 | + if (scsi_target_len > 256) | |
444 | + scsi_target_len = 256; | |
445 | 445 | |
446 | 446 | buf[off-1] = scsi_target_len; |
447 | 447 | off += scsi_target_len; |