~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to debian/patches/0007-bb-11028-fixed-a-deadlock-issue-with-fanotify-and-lo.patch

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
 
 
6
---
 
7
 clamd/server-th.c | 5 +++++
 
8
 1 file changed, 5 insertions(+)
 
9
 
 
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;
 
17
 int sighup = 0;
 
18
+extern pthread_mutex_t logg_mutex;
 
19
 static struct cl_stat dbstat;
 
20
 
 
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);
 
30
            }
 
31
 #endif
 
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);
 
40
     }
 
41
 #endif