From d64347d286b256e631b34b77c82216c0f122da42 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: I8f83175c7b550d8674dda5030168d5b94ccdd04c BUG: 1361665 Signed-off-by: Soumya Koduri Reviewed-on: http://review.gluster.org/15048 NetBSD-regression: NetBSD Build System Reviewed-by: Niels de Vos Smoke: Gluster Build System Reviewed-by: jiffin tony Thottan CentOS-regression: Gluster Build System --- 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 2b436f9bc4d..d09e81ddb1a 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -2037,6 +2037,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; } } @@ -2073,7 +2074,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