aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger2013-02-18 20:31:37 -0600
committerGreg Kroah-Hartman2013-03-03 16:09:04 -0600
commit954497ea2037e8c42fe1c7a0882030b62ac9116c (patch)
treea8d507a871df1784dd5fd32bca8744031f4c5aa5
parent93b6b299f7a97a8ce2f8ab7b14195f8d2d131905 (diff)
downloadkernel-common-954497ea2037e8c42fe1c7a0882030b62ac9116c.tar.gz
kernel-common-954497ea2037e8c42fe1c7a0882030b62ac9116c.tar.xz
kernel-common-954497ea2037e8c42fe1c7a0882030b62ac9116c.zip
target: Add missing mapped_lun bounds checking during make_mappedlun setup
commit fbbf8555a986ed31e54f006b6cc637ea4ff1425b upstream. This patch adds missing bounds checking for the configfs provided mapped_lun value during target_fabric_make_mappedlun() setup ahead of se_lun_acl initialization. This addresses a potential OOPs when using a mapped_lun value that exceeds the hardcoded TRANSPORT_MAX_LUNS_PER_TPG-1 value within se_node_acl->device_list[]. Reported-by: Jan Engelhardt <jengelh@inai.de> Cc: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/target/target_core_fabric_configfs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
index 07ab5a3bb8e..6246f28eac4 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -355,6 +355,14 @@ static struct config_group *target_fabric_make_mappedlun(
355 ret = -EINVAL; 355 ret = -EINVAL;
356 goto out; 356 goto out;
357 } 357 }
358 if (mapped_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) {
359 pr_err("Mapped LUN: %lu exceeds TRANSPORT_MAX_LUNS_PER_TPG"
360 "-1: %u for Target Portal Group: %u\n", mapped_lun,
361 TRANSPORT_MAX_LUNS_PER_TPG-1,
362 se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg));
363 ret = -EINVAL;
364 goto out;
365 }
358 366
359 lacl = core_dev_init_initiator_node_lun_acl(se_tpg, mapped_lun, 367 lacl = core_dev_init_initiator_node_lun_acl(se_tpg, mapped_lun,
360 config_item_name(acl_ci), &ret); 368 config_item_name(acl_ci), &ret);