From: Jérémie Galarneau Date: Tue, 18 Aug 2020 20:01:30 +0000 (-0400) Subject: Fix: sessiond: client/client_list lock inversion on disconnect X-Git-Tag: v2.13.0-rc1~491 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=6c24d3fd5ade8231445e720c174afe3da4210179;hp=6c24d3fd5ade8231445e720c174afe3da4210179 Fix: sessiond: client/client_list lock inversion on disconnect Coverity reports a lock inversion scenario in handle_notification_thread_client_disconnect() where a client's lock is held while acquiring the client list lock. This is indeed a problem. As indicated in the notification_client and notification_client_list comments, the locking was shoe-horned to make it possible for the action executor to enqueue notifications in a client's outgoing queue and flush it. Since this is the only access pattern that is supported, the client locking is reworked slightly to only acquire the client lock when checking the "active" flag, interacting with the outbound communication state, and sending through a client's socket. This change makes the client locking regions more narrow which accounts for the somewhat large number of lines affected. The updates to the `active` flag on error are moved to the function that flushes the outbound queue instead of expecting the callers to set it. This allows the locking to be limited to this function rather than relying on the callers. Signed-off-by: Jérémie Galarneau Change-Id: I8632d0f7785ec727dabd329bdfba010fd5e4643a ---