From 92a7389317838f3338466df0c0e3d23ad33cb1f4 Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Tue, 4 Dec 2012 23:43:57 -0800 Subject: target: Add link_magic for fabric allow_link destination target_items commit 0ff8754981261a80f4b77db2536dfea92c2d4539 upstream. This patch adds [dev,lun]_link_magic value assignment + checks within generic target_fabric_port_link() and target_fabric_mappedlun_link() code to ensure destination config_item *target_item sent from configfs_symlink() -> config_item_operations->allow_link() is the underlying se_device->dev_group and se_lun->lun_group that we expect to symlink. Reported-by: Sebastian Andrzej Siewior Cc: Sebastian Andrzej Siewior Signed-off-by: Nicholas Bellinger Signed-off-by: CAI Qian Signed-off-by: Greg Kroah-Hartman --- include/target/target_core_base.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 3ad5b33ee32..569c28236b0 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -779,6 +779,8 @@ struct se_subsystem_dev { }; struct se_device { +#define SE_DEV_LINK_MAGIC 0xfeeddeef + u32 dev_link_magic; /* RELATIVE TARGET PORT IDENTIFER Counter */ u16 dev_rpti_counter; /* Used for SAM Task Attribute ordering */ @@ -869,6 +871,8 @@ struct se_port_stat_grps { }; struct se_lun { +#define SE_LUN_LINK_MAGIC 0xffff7771 + u32 lun_link_magic; /* See transport_lun_status_table */ enum transport_lun_status_table lun_status; u32 lun_access; -- cgit v1.2.3-18-g5258