From: Avinash Repaka Date: Thu, 31 Aug 2017 21:37:42 +0000 (-0700) Subject: RDS: IB: Destroy aux_wq if rds_ib_init() fails X-Git-Tag: v4.1.12-111.0.20170918_2215~257 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2198b5347fa01fb24a991d93d940d21e4cc37105;p=users%2Fjedix%2Flinux-maple.git RDS: IB: Destroy aux_wq if rds_ib_init() fails This patch destroys rds_aux_wq in rds_ib_init() error path to avoid memory leak. Since destroy_workqueue() waits on pending work to be done, we can remove flush_workqueue() prior to destroying. Orabug: 26732887 Signed-off-by: Avinash Repaka Reviewed-by: Gerd Rausch Reviewed-by: HÃ¥kon Bugge --- diff --git a/net/rds/ib.c b/net/rds/ib.c index 35dac3bfee74b..e84143bbf62d2 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -2707,14 +2707,14 @@ int rds_ib_init(void) ret = rds_trans_register(&rds_ib_transport); if (ret) - goto out_ibreg; + goto out_aux_wq; rds_info_register_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info); ret = rds_ip_threads_init(); if (ret) { printk(KERN_ERR "RDS: failed to create IP thread\n"); - goto out_ibreg; + goto out_aux_wq; } rds_ib_ip_excl_ips_init(); @@ -2733,6 +2733,8 @@ int rds_ib_init(void) out_ip_thread: rds_ip_thread_exit(); +out_aux_wq: + destroy_workqueue(rds_aux_wq); out_ibreg: rds_ib_unregister_client(); out_recv: @@ -2754,7 +2756,6 @@ void rds_ib_exit(void) rds_ib_destroy_nodev_conns(); rds_ib_sysctl_exit(); rds_ib_recv_exit(); - flush_workqueue(rds_aux_wq); destroy_workqueue(rds_aux_wq); rds_trans_unregister(&rds_ib_transport); rds_ib_fmr_exit();