Skip to content

Commit bbc0f8b

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: libfc: Add WARN_ON() when deleting rports
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> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent bc3d12b commit bbc0f8b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/libfc/fc_rport.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ void fc_rport_destroy(struct kref *kref)
184184
struct fc_rport_priv *rdata;
185185

186186
rdata = container_of(kref, struct fc_rport_priv, kref);
187+
WARN_ON(!list_empty(&rdata->peers));
187188
kfree_rcu(rdata, rcu);
188189
}
189190
EXPORT_SYMBOL(fc_rport_destroy);

0 commit comments

Comments
 (0)