mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
BUG/MINOR: ssl/cli: fix a lock leak when no memory available
This bug was introduced ine5ff4ad
("BUG/MINOR: ssl: fix a trash buffer leak in some error cases"). When cli_parse_set_cert() returns because alloc_trash_chunk() failed, it does not unlock the spinlock which can lead to a deadlock later. Must be backported as far as 2.1 wheree5ff4ad
was backported.
This commit is contained in:
parent
18b2a9dd87
commit
5ba80d677d
@ -1560,8 +1560,11 @@ static int cli_parse_set_cert(char **args, char *payload, struct appctx *appctx,
|
|||||||
if (HA_SPIN_TRYLOCK(CKCH_LOCK, &ckch_lock))
|
if (HA_SPIN_TRYLOCK(CKCH_LOCK, &ckch_lock))
|
||||||
return cli_err(appctx, "Can't update the certificate!\nOperations on certificates are currently locked!\n");
|
return cli_err(appctx, "Can't update the certificate!\nOperations on certificates are currently locked!\n");
|
||||||
|
|
||||||
if ((buf = alloc_trash_chunk()) == NULL)
|
if ((buf = alloc_trash_chunk()) == NULL) {
|
||||||
return cli_err(appctx, "Can't allocate memory\n");
|
memprintf(&err, "%sCan't allocate memory\n", err ? err : "");
|
||||||
|
errcode |= ERR_ALERT | ERR_FATAL;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
if (!chunk_strcpy(buf, args[3])) {
|
if (!chunk_strcpy(buf, args[3])) {
|
||||||
memprintf(&err, "%sCan't allocate memory\n", err ? err : "");
|
memprintf(&err, "%sCan't allocate memory\n", err ? err : "");
|
||||||
|
Loading…
Reference in New Issue
Block a user