Skip to content

Commit 44d03b9

Browse files
Nicholas Bellingergregkh
authored andcommitted
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>
1 parent fcc038d commit 44d03b9

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/target/target_core_device.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,15 @@ int core_enable_device_list_for_node(
362362
kfree(new);
363363
return -EINVAL;
364364
}
365-
BUG_ON(orig->se_lun_acl != NULL);
365+
if (orig->se_lun_acl != NULL) {
366+
pr_warn_ratelimited("Detected existing explicit"
367+
" se_lun_acl->se_lun_group reference for %s"
368+
" mapped_lun: %llu, failing\n",
369+
nacl->initiatorname, mapped_lun);
370+
mutex_unlock(&nacl->lun_entry_mutex);
371+
kfree(new);
372+
return -EINVAL;
373+
}
366374

367375
rcu_assign_pointer(new->se_lun, lun);
368376
rcu_assign_pointer(new->se_lun_acl, lun_acl);

0 commit comments

Comments
 (0)