aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2016-10-23 17:28:15 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2017-02-08 10:46:31 -0500
commit391e2a6de9781e4906dd7e0b1cc097050bf43e11 (patch)
tree42ebf04325bc226435f330a75677dbe141f26a0b
parentd5adbfcd5f7bcc6fa58a41c5c5ada0e5c826ce2c (diff)
target: Don't BUG_ON during NodeACL dynamic -> explicit conversion
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> Cc: stable@vger.kernel.org # 4.2+ Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-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 1ebd13ef7bd3..26929c44d703 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -352,7 +352,15 @@ int core_enable_device_list_for_node(
352 kfree(new); 352 kfree(new);
353 return -EINVAL; 353 return -EINVAL;
354 } 354 }
355 BUG_ON(orig->se_lun_acl != NULL); 355 if (orig->se_lun_acl != NULL) {
356 pr_warn_ratelimited("Detected existing explicit"
357 " se_lun_acl->se_lun_group reference for %s"
358 " mapped_lun: %llu, failing\n",
359 nacl->initiatorname, mapped_lun);
360 mutex_unlock(&nacl->lun_entry_mutex);
361 kfree(new);
362 return -EINVAL;
363 }
356 364
357 rcu_assign_pointer(new->se_lun, lun); 365 rcu_assign_pointer(new->se_lun, lun);
358 rcu_assign_pointer(new->se_lun_acl, lun_acl); 366 rcu_assign_pointer(new->se_lun_acl, lun_acl);