summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 15:57:49 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:14:23 +0530
commitb46296282155281768407c93f878ba3823118463 (patch)
tree4097a800b7f7e73bf22709446ab2fb8a1430d350
parent4ecd27aed126b20012abe1449bc49b4c646cb9d0 (diff)
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 <avati@amp.gluster.com>
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 9a8ead505d4..0a7b31e210a 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)) {