From: Vasu Dev <vasu.dev@xxxxxxxxx> Initializing these libfc globals per lport could mess up exch allocation/free for existing lport. So this patch moves their initialization to fc_setup_exch_mgr so that these globals gets initialized only once for libfc. Reported-by: Alex Lyakas <alexl@xxxxxxxxxxxxxx> Signed-off-by: Vasu Dev <vasu.dev@xxxxxxxxx> Signed-off-by: Robert Love <robert.w.love@xxxxxxxxx> --- drivers/scsi/libfc/fc_exch.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index dec61e5..d58111f 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -2303,6 +2303,20 @@ int fc_exch_init(struct fc_lport *lport) if (!lport->tt.seq_exch_abort) lport->tt.seq_exch_abort = fc_seq_exch_abort; + return 0; +} +EXPORT_SYMBOL(fc_exch_init); + +/** + * fc_setup_exch_mgr() - Setup an exchange manager + */ +int fc_setup_exch_mgr() +{ + fc_em_cachep = kmem_cache_create("libfc_em", sizeof(struct fc_exch), + 0, SLAB_HWCACHE_ALIGN, NULL); + if (!fc_em_cachep) + return -ENOMEM; + /* * Initialize fc_cpu_mask and fc_cpu_order. The * fc_cpu_mask is set for nr_cpu_ids rounded up @@ -2327,19 +2341,6 @@ int fc_exch_init(struct fc_lport *lport) return 0; } -EXPORT_SYMBOL(fc_exch_init); - -/** - * fc_setup_exch_mgr() - Setup an exchange manager - */ -int fc_setup_exch_mgr() -{ - fc_em_cachep = kmem_cache_create("libfc_em", sizeof(struct fc_exch), - 0, SLAB_HWCACHE_ALIGN, NULL); - if (!fc_em_cachep) - return -ENOMEM; - return 0; -} /** * fc_destroy_exch_mgr() - Destroy an exchange manager -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html