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

2018-07-11 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 
-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


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

2018-07-11 Thread Hannes Reinecke
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 
---
 drivers/scsi/libfc/fc_rport.c | 1 +
 1 file changed, 1 insertion(+)

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(>peers));
kfree_rcu(rdata, rcu);
 }
 EXPORT_SYMBOL(fc_rport_destroy);
-- 
2.12.3