mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-05 22:56:57 +02:00
BUG/MEDIUM: peers: Fix crash when syncing learn state of a peer without appctx
For a given peer, the synchronization of the learn state is no longer performed in the peer appctx. It is delayed to be handled by the peers sync task. It means that for a given peer, it is possible to have finished to learn and only handle it after the appctx release. So the synchronization may happen on a peer without appctx. This was not tested and an unconditionnal wakeup on the appctx could lead to a crash because of a NULL-deref. It may be experienced by running reg-tests/peers/tls_basic_sync.vtc script in loop. The fix is obivous. In sync_peer_learn_state(), we must omit to wakeup the appctx if it was already released. This patch should fix issue #2629. It must be backported to 3.0.
This commit is contained in:
parent
95f624540b
commit
3e2d1476e6
@ -3341,7 +3341,8 @@ static void sync_peer_learn_state(struct peers *peers, struct peer *peer)
|
||||
HA_ATOMIC_AND(&peers->flags, ~PEERS_F_RESYNC_ASSIGN);
|
||||
HA_ATOMIC_OR(&peers->flags, flags);
|
||||
|
||||
appctx_wakeup(peer->appctx);
|
||||
if (peer->appctx)
|
||||
appctx_wakeup(peer->appctx);
|
||||
}
|
||||
|
||||
/* Synchronise the peer applet state with its associated peers section. This
|
||||
|
Loading…
Reference in New Issue
Block a user