]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.29/target-fix-regression-with-dev_link_magic-in-target_fabric_port_link.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.29 / target-fix-regression-with-dev_link_magic-in-target_fabric_port_link.patch
1 From caiqian@redhat.com Fri Feb 1 11:39:40 2013
2 From: Nicholas Bellinger <nab@linux-iscsi.org>
3 Date: Thu, 24 Jan 2013 21:57:14 -0500 (EST)
4 Subject: target: fix regression with dev_link_magic in target_fabric_port_link
5 To: stable@vger.kernel.org
6 Cc: Nicholas Bellinger <nab@linux-iscsi.org>, Chris Boot <bootc@bootc.net>
7 Message-ID: <1667210120.9168305.1359082634537.JavaMail.root@redhat.com>
8
9 From: Nicholas Bellinger <nab@linux-iscsi.org>
10
11 This is to fix a regression that only affect the stable (not for the mainline)
12 that the stable commit fdf9d86 was incorrectly placed dev->dev_link_magic check
13 before the *dev assignment in target_fabric_port_link() due to fuzzy automatically
14 context adjustment during the back-porting.
15
16 Reported-by: Chris Boot <bootc@bootc.net>
17 Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
18 Signed-off-by: CAI Qian <caiqian@redhat.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 drivers/target/target_core_fabric_configfs.c | 11 +++++------
23 1 file changed, 5 insertions(+), 6 deletions(-)
24
25 --- a/drivers/target/target_core_fabric_configfs.c
26 +++ b/drivers/target/target_core_fabric_configfs.c
27 @@ -752,12 +752,6 @@ static int target_fabric_port_link(
28 struct target_fabric_configfs *tf;
29 int ret;
30
31 - if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) {
32 - pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:"
33 - " %p to struct se_device: %p\n", se_dev_ci, dev);
34 - return -EFAULT;
35 - }
36 -
37 tpg_ci = &lun_ci->ci_parent->ci_group->cg_item;
38 se_tpg = container_of(to_config_group(tpg_ci),
39 struct se_portal_group, tpg_group);
40 @@ -775,6 +769,11 @@ static int target_fabric_port_link(
41 ret = -ENODEV;
42 goto out;
43 }
44 + if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) {
45 + pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:"
46 + " %p to struct se_device: %p\n", se_dev_ci, dev);
47 + return -EFAULT;
48 + }
49
50 lun_p = core_dev_add_lun(se_tpg, dev->se_hba, dev,
51 lun->unpacked_lun);