1
From c35cbaa68c69af8c9f66da1ae99d05023ff242bf Mon Sep 17 00:00:00 2001
2
From: Kevin Lin <klin@sourcefire.com>
3
Date: Thu, 5 Jun 2014 12:20:57 -0400
4
Subject: bb#11028 - fixed a deadlock issue with fanotify and logg_mutex
7
clamd/server-th.c | 5 +++++
8
1 file changed, 5 insertions(+)
10
diff --git a/clamd/server-th.c b/clamd/server-th.c
11
index 8d81bb8..4f91b49 100644
12
--- a/clamd/server-th.c
13
+++ b/clamd/server-th.c
14
@@ -71,6 +71,7 @@ int reload = 0;
15
time_t reloaded_time = 0;
16
pthread_mutex_t reload_mutex = PTHREAD_MUTEX_INITIALIZER;
18
+extern pthread_mutex_t logg_mutex;
19
static struct cl_stat dbstat;
21
void *event_wake_recv = NULL;
22
@@ -1392,7 +1393,9 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
23
#if defined(FANOTIFY) || defined(CLAMAUTH)
24
if(optget(opts, "ScanOnAccess")->enabled && tharg) {
25
logg("Restarting on-access scan\n");
26
+ pthread_mutex_lock(&logg_mutex);
27
pthread_kill(fan_pid, SIGUSR1);
28
+ pthread_mutex_unlock(&logg_mutex);
29
pthread_join(fan_pid, NULL);
32
@@ -1438,7 +1441,9 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi
33
#if defined(FANOTIFY) || defined(CLAMAUTH)
34
if(optget(opts, "ScanOnAccess")->enabled && tharg) {
35
logg("Stopping on-access scan\n");
36
+ pthread_mutex_lock(&logg_mutex);
37
pthread_kill(fan_pid, SIGUSR1);
38
+ pthread_mutex_unlock(&logg_mutex);
39
pthread_join(fan_pid, NULL);