From: Martin Wilck <[email protected]>

This fixes a coverity-reported defect (413384 Data race condition).
Indeed, we always set servicing_uev with the lock held, so it makes
sense to read it with the lock held, too.

Signed-off-by: Martin Wilck <[email protected]>
---
 libmultipath/uevent.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 3b5dd31..32135d7 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -82,12 +82,13 @@ static void reset_filter_state(struct uevent_filter_state 
*st)
 
 int is_uevent_busy(void)
 {
-       int empty;
+       int empty, servicing;
 
        pthread_mutex_lock(uevq_lockp);
        empty = list_empty(&uevq);
+       servicing = servicing_uev;
        pthread_mutex_unlock(uevq_lockp);
-       return (!empty || servicing_uev);
+       return (!empty || servicing);
 }
 
 struct uevent * alloc_uevent (void)
-- 
2.43.0


Reply via email to