From b46296282155281768407c93f878ba3823118463 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 5 May 2009 15:57:49 +0530 Subject: libglusterfsclient: Guard against un-inited VMP searches On my system, an selinux module gets inited before booster even though the FS calls from the selinux module get routed through our LD_PRELOAD'ed wrappers. In this scenario, the VMP list is un-inited, resulting in a seg-fault if it is dereferenced. The list_empty check does not help because the pointers in the list have non-NULL values. Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 9a8ead505..0a7b31e21 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -958,6 +958,12 @@ libgf_vmp_search_entry (char *path) goto out; } + /* This check is to guard against any calls into booster from + * libc without booster_init having been called first. + * This has been observed. + */ + if (vmpentries == 0) + goto out; list_for_each_entry(entry, &vmplist.list, list) { matchcount = libgf_vmp_entry_match (entry, path); if ((matchcount == entry->vmplen) && (matchcount > maxcount)) { -- cgit