From 3fdf80501f9539067a0801ad279446a4be9013d3 Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Thu, 21 Jul 2016 12:14:27 +0530 Subject: glfs/upcall: entries should be removed under mutex lock During poll, upcall entries should be removed from the upcall_list only under upcall_list_mutex lock. Otherwise it could result in the list corruption if there are entries being added during poll resulting in memory leak. Also addressed a probable leak during any failures with upcall entry addition. This is backport of below master patch - http://review.gluster.org/14972 >Change-Id: I468183f961eb6faed9a0a1bcb783705f711641fc >BUG: 1358608 >Signed-off-by: Soumya Koduri >Reviewed-on: http://review.gluster.org/14972 >Reviewed-by: Shyamsundar Ranganathan >Reviewed-by: Jeff Darcy >(cherry picked from commit 89dee8b46e126bc1d7541da90fa60844aa83451e) Change-Id: Ib6702911ca1fa09a3f1a493b27195665603854d3 BUG: 1362010 Signed-off-by: Soumya Koduri Reviewed-on: http://review.gluster.org/15058 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Tested-by: Oleksandr Natalenko CentOS-regression: Gluster Build System Reviewed-by: Niels de Vos --- api/src/glfs-handleops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api/src/glfs-handleops.c') diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index 1c5546ec427..0ee7e7d37b7 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -2033,6 +2033,7 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg) &fs->upcall_list, upcall_list) { found = 1; + list_del_init (&u_list->upcall_list); break; } } @@ -2069,7 +2070,6 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg) up_arg->reason = reason; - list_del_init (&u_list->upcall_list); GF_FREE (u_list->upcall_data.data); GF_FREE (u_list); } -- cgit