Commit 12f09ccb authored by Dan Carpenter's avatar Dan Carpenter Committed by Nicholas Bellinger

loopback: off by one in tcm_loop_make_naa_tpg()

This is an off by one 'tgpt' check in tcm_loop_make_naa_tpg() that could result
in memory corruption.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarNicholas A. Bellinger <nab@linux-iscsi.org>
parent 21bca31c
...@@ -1205,7 +1205,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg( ...@@ -1205,7 +1205,7 @@ struct se_portal_group *tcm_loop_make_naa_tpg(
tpgt_str += 5; /* Skip ahead of "tpgt_" */ tpgt_str += 5; /* Skip ahead of "tpgt_" */
tpgt = (unsigned short int) simple_strtoul(tpgt_str, &end_ptr, 0); 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:" printk(KERN_ERR "Passed tpgt: %hu exceeds TL_TPGS_PER_HBA:"
" %u\n", tpgt, TL_TPGS_PER_HBA); " %u\n", tpgt, TL_TPGS_PER_HBA);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment