Skip to content

Commit

Permalink
loopback: off by one in tcm_loop_make_naa_tpg()
Browse files Browse the repository at this point in the history
This is an off by one 'tgpt' check in tcm_loop_make_naa_tpg() that could result
in memory corruption.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
  • Loading branch information
error27 authored and nablio3000 committed Jul 22, 2011
1 parent 21bca31 commit 12f09cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/target/loopback/tcm_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg(
tpgt_str += 5; /* Skip ahead of "tpgt_" */
tpgt = (unsigned short int) simple_strtoul(tpgt_str, &end_ptr, 0);

if (tpgt > TL_TPGS_PER_HBA) {
if (tpgt >= TL_TPGS_PER_HBA) {
printk(KERN_ERR "Passed tpgt: %hu exceeds TL_TPGS_PER_HBA:"
" %u\n", tpgt, TL_TPGS_PER_HBA);
return ERR_PTR(-EINVAL);
Expand Down

0 comments on commit 12f09cc

Please sign in to comment.