File 0001-iminternal-suppress-mutex-double-unlock.patch of Package rsyslog.24024

From 2e9d389419a42b63c8d6815302ec0807045207ee Mon Sep 17 00:00:00 2001
From: Thomas Blume <thomas.blume@suse.com>
Date: Thu, 11 Jul 2019 12:58:10 +0200
Subject: [PATCH] iminternal: suppress mutex double-unlock

If there is a burst of log messages during a time when rsyslog is unable
to output (either during log rotation, an out-of-space condition, or
some other similar condition), rsyslog can SEGFAULT due to a mutex
double-unlock.
---
 tools/iminternal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/iminternal.c b/tools/iminternal.c
index 66b419a6b..4983aa177 100644
--- a/tools/iminternal.c
+++ b/tools/iminternal.c
@@ -93,7 +93,6 @@ rsRetVal iminternalAddMsg(smsg_t *pMsg)
 	#else
 	r = pthread_mutex_trylock(&mutList); // must check
 	#endif
-	is_locked = 1;
 	if(r != 0) {
 		dbgprintf("iminternalAddMsg: timedlock for mutex failed with %d, msg %s\n",
 			r, getMSG(pMsg));
@@ -101,6 +100,7 @@ rsRetVal iminternalAddMsg(smsg_t *pMsg)
 		msgDestruct(&pMsg);
 		ABORT_FINALIZE(RS_RET_ERR);
 	}
+	is_locked = 1;
 	CHKiRet(iminternalConstruct(&pThis));
 	pThis->pMsg = pMsg;
 	CHKiRet(llAppend(&llMsgs,  NULL, (void*) pThis));
-- 
2.16.4

openSUSE Build Service is sponsored by