diff mbox

[3/4] libfc: Add WARN_ON() when deleting rports

Message ID 20180711080930.24400-4-hare@suse.de (mailing list archive)
State Accepted
Headers show

Commit Message

Hannes Reinecke July 11, 2018, 8:09 a.m. UTC
The discovery rport list handling is quite odd; the list traversal
is independent from the lifetime of the rport itself. This makes
auditing quite tricky, and the chance remains that we've missed
something.
So this patch adds a WARN_ON() statement when freeing an rport which
is still part of a list.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/libfc/fc_rport.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Johannes Thumshirn July 11, 2018, 12:03 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox

Patch

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 3d51a936f6d5..d69531ab2db8 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -184,6 +184,7 @@  void fc_rport_destroy(struct kref *kref)
 	struct fc_rport_priv *rdata;
 
 	rdata = container_of(kref, struct fc_rport_priv, kref);
+	WARN_ON(!list_empty(&rdata->peers));
 	kfree_rcu(rdata, rcu);
 }
 EXPORT_SYMBOL(fc_rport_destroy);