diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-02-18 21:31:37 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-02-18 21:47:28 -0500 |
commit | fbbf8555a986ed31e54f006b6cc637ea4ff1425b (patch) | |
tree | 5e95a54ec56f9470b8269dd73b1ccff3d4653ef9 /drivers/target | |
parent | fcf29481fb8e106daad6688f2e898226ee928992 (diff) |
target: Add missing mapped_lun bounds checking during make_mappedlun setup
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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-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 b932653358dd..04c775cb3e65 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -354,6 +354,14 @@ static struct config_group *target_fabric_make_mappedlun( | |||
354 | ret = -EINVAL; | 354 | ret = -EINVAL; |
355 | goto out; | 355 | goto out; |
356 | } | 356 | } |
357 | if (mapped_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) { | ||
358 | pr_err("Mapped LUN: %lu exceeds TRANSPORT_MAX_LUNS_PER_TPG" | ||
359 | "-1: %u for Target Portal Group: %u\n", mapped_lun, | ||
360 | TRANSPORT_MAX_LUNS_PER_TPG-1, | ||
361 | se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg)); | ||
362 | ret = -EINVAL; | ||
363 | goto out; | ||
364 | } | ||
357 | 365 | ||
358 | lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl, | 366 | lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl, |
359 | mapped_lun, &ret); | 367 | mapped_lun, &ret); |