mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
fcf29481fb
commit
fbbf8555a9
|
@ -354,6 +354,14 @@ static struct config_group *target_fabric_make_mappedlun(
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
if (mapped_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) {
|
||||||
|
pr_err("Mapped LUN: %lu exceeds TRANSPORT_MAX_LUNS_PER_TPG"
|
||||||
|
"-1: %u for Target Portal Group: %u\n", mapped_lun,
|
||||||
|
TRANSPORT_MAX_LUNS_PER_TPG-1,
|
||||||
|
se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg));
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl,
|
lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl,
|
||||||
mapped_lun, &ret);
|
mapped_lun, &ret);
|
||||||
|
|
Loading…
Reference in New Issue