aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2016-10-23 17:28:15 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-14 18:25:36 -0500
commiteb49824ca9c9fb1030cf9a6e51a89fa2471422fa (patch)
tree912dbf2a211f822965285162a50e4f4c8982fc2f /drivers/target
parent4cd462c7f2b6fcc208aebf44f2c831681feaa925 (diff)
target: Don't BUG_ON during NodeACL dynamic -> explicit conversion
commit 391e2a6de9781e4906dd7e0b1cc097050bf43e11 upstream. After the v4.2+ RCU conversion to se_node_acl->lun_entry_hlist, a BUG_ON() was added in core_enable_device_list_for_node() to detect when the located orig->se_lun_acl contains an existing se_lun_acl pointer reference. However, this scenario can happen when a dynamically generated NodeACL is being converted to an explicit NodeACL, when the explicit NodeACL contains a different LUN mapping than the default provided by the WWN endpoint. So instead of triggering BUG_ON(), go ahead and fail instead following the original pre RCU conversion logic. Reported-by: Benjamin ESTRABAUD <ben.estrabaud@mpstor.com> Cc: Benjamin ESTRABAUD <ben.estrabaud@mpstor.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_device.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 6b423485c5d6..ea9617c7b403 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -351,7 +351,15 @@ int core_enable_device_list_for_node(
351 kfree(new); 351 kfree(new);
352 return -EINVAL; 352 return -EINVAL;
353 } 353 }
354 BUG_ON(orig->se_lun_acl != NULL); 354 if (orig->se_lun_acl != NULL) {
355 pr_warn_ratelimited("Detected existing explicit"
356 " se_lun_acl->se_lun_group reference for %s"
357 " mapped_lun: %llu, failing\n",
358 nacl->initiatorname, mapped_lun);
359 mutex_unlock(&nacl->lun_entry_mutex);
360 kfree(new);
361 return -EINVAL;
362 }
355 363
356 rcu_assign_pointer(new->se_lun, lun); 364 rcu_assign_pointer(new->se_lun, lun);
357 rcu_assign_pointer(new->se_lun_acl, lun_acl); 365 rcu_assign_pointer(new->se_lun_acl, lun_acl);