rds: fix memory leak error
Subsystems (4)
PATCH 1/1 rds: fix memory leak error
When the function register_netdevice_notifier fails, the memory allocated by kmem_cache_create should be freed by the function kmem_cache_destroy.
--- net/rds/tcp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/rds/tcp.c +4 -3
@@ -641,12 +641,12 @@ static int rds_tcp_init(void) ret =register_netdevice_notifier (&rds_tcp_dev_notifier);if (ret) {pr_warn ("could not register rds_tcp_dev_notifier\n" ); - goto out; + goto out_slab; } ret =register_pernet_subsys (&rds_tcp_net_ops);if (ret) - goto out_slab; + goto out_notifier; ret =rds_tcp_recv_init ();if (ret)
@@ -664,9 +664,10 @@ static int rds_tcp_init(void)rds_tcp_recv_exit (); out_pernet:unregister_pernet_subsys (&rds_tcp_net_ops); -out_slab: +out_notifier:if (unregister_netdevice_notifier (&rds_tcp_dev_notifier))pr_warn ("could not unregister rds_tcp_dev_notifier\n" ); +out_slab:kmem_cache_destroy (rds_tcp_conn_slab); out:return ret;
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Zhu Yanjun
When the function
register_netdevice_notifierfails, the memory allocated bykmem_cache_createshould be freed by the functionkmem_cache_destroy.Cc Joe Jin <[email protected]>Cc Junxiao Bi <[email protected]>Signed-off-by Zhu Yanjun <[email protected]>---
Minor nit with subject.
s/rds/RDS: TCP:
patch looks fine to me.
Acked:by: Santosh Shilimkar <[email protected]> --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
sowmini
Acked-byQuoted 7 lines · Zhu Yanjun
When the function
register_netdevice_notifierfails, the memory allocated bykmem_cache_createshould be freed by the functionkmem_cache_destroy.Cc Joe Jin <[email protected]>Cc Junxiao Bi <[email protected]>Signed-off-by Zhu Yanjun <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Santosh Shilimkar <[email protected]>
Date: Fri, 24 Feb 2017 08:49:19 -0800
Quoted 11 lines · Zhu Yanjun
Quoted 8 lines
When the function
register_netdevice_notifierfails, the memory allocated bykmem_cache_createshould be freed by the functionkmem_cache_destroy.Cc Joe Jin <[email protected]>Cc Junxiao Bi <[email protected]>Signed-off-by Zhu Yanjun <[email protected]>---
Minor nit with subject.
s/rds/RDS: TCP:
Please, I definitely prefer people use all lowercase letters for the susbsystem prefix in the subject line.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Zhu Yanjun <[email protected]>
Date: Fri, 24 Feb 2017 04:28:01 -0500
Quoted 7 lines
When the function
register_netdevice_notifierfails, the memory allocated bykmem_cache_createshould be freed by the functionkmem_cache_destroy.Cc Joe Jin <[email protected]>Cc Junxiao Bi <[email protected]>Signed-off-by Zhu Yanjun <[email protected]>
Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 12 lines · David Miller
From: Santosh Shilimkar <[email protected]>
Date: Fri, 24 Feb 2017 08:49:19 -0800Quoted 9 lines · Zhu Yanjun
Quoted 8 lines
When the function
register_netdevice_notifierfails, the memory allocated bykmem_cache_createshould be freed by the functionkmem_cache_destroy.Cc Joe Jin <[email protected]>Cc Junxiao Bi <[email protected]>Signed-off-by Zhu Yanjun <[email protected]>---
Quoted 6 lines
Quoted 2 lines
Minor nit with subject.
s/rds/RDS: TCP:Please, I definitely prefer people use all lowercase letters for the susbsystem prefix in the subject line.
Note for the future. Thanks Dave !!
Regards,
Santosh