diff options
author | Nicholas Bellinger | 2013-02-18 20:31:37 -0600 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-03-03 16:06:39 -0600 |
commit | 316857e5fe5391057d5a05f215e01d0deff7c473 (patch) | |
tree | 0e701551c2631af261b632b407c0d2c5577b79fb | |
parent | 3fa4f7261d75cb6b35fdf8d329f5fd64e7354c58 (diff) | |
download | kernel-common-316857e5fe5391057d5a05f215e01d0deff7c473.tar.gz kernel-common-316857e5fe5391057d5a05f215e01d0deff7c473.tar.xz kernel-common-316857e5fe5391057d5a05f215e01d0deff7c473.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.c | 8 |
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 1516bda3f75..6b79ee71152 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -356,6 +356,14 @@ static struct config_group *target_fabric_make_mappedlun( | |||
356 | ret = -EINVAL; | 356 | ret = -EINVAL; |
357 | goto out; | 357 | goto out; |
358 | } | 358 | } |
359 | if (mapped_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) { | ||
360 | pr_err("Mapped LUN: %lu exceeds TRANSPORT_MAX_LUNS_PER_TPG" | ||
361 | "-1: %u for Target Portal Group: %u\n", mapped_lun, | ||
362 | TRANSPORT_MAX_LUNS_PER_TPG-1, | ||
363 | se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg)); | ||
364 | ret = -EINVAL; | ||
365 | goto out; | ||
366 | } | ||
359 | 367 | ||
360 | lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl, | 368 | lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl, |
361 | mapped_lun, &ret); | 369 | mapped_lun, &ret); |