Skip to content

Commit

Permalink
target: Fix missing length check in spc_emulate_evpd_83()
Browse files Browse the repository at this point in the history
Commit fbfe858 ("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>
  • Loading branch information
Roland Dreier authored and Nicholas Bellinger committed Feb 12, 2014
1 parent 2d15025 commit 6a16d7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/target/target_core_spc.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ spc_emulate_evpd_83(struct se_cmd *cmd, unsigned char *buf)
padding = ((-scsi_target_len) & 3);
if (padding)
scsi_target_len += padding;
if (scsi_name_len > 256)
scsi_name_len = 256;
if (scsi_target_len > 256)
scsi_target_len = 256;

buf[off-1] = scsi_target_len;
off += scsi_target_len;
Expand Down

0 comments on commit 6a16d7b

Please sign in to comment.