]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 5322: Do not leak HttpReply when checking http_reply_access (#1764) auto master
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 3 May 2024 02:00:08 +0000 (02:00 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 3 May 2024 16:36:11 +0000 (16:36 +0000)
commitb1c2ea7ae7cac805f254ddb9922f3851d18547d9
tree3431c4b90281745e8c0b4cdb8fdc8221adba57e4
parent2c3d6a4ee3f42bc5026d7a41a9fee8ae7dc8cb42
Bug 5322: Do not leak HttpReply when checking http_reply_access (#1764)

... as well as response_delay_pool and send_hit directives.

    auto check = clientAclChecklistCreate(...); // sets check->reply
    check->reply = reply; // self-assignment does nothing
    HTTPMSGLOCK(check->reply); // an unwanted/extra lock

When ACLFilledChecklist::reply is already set to X, resetting it to X
should not change HttpReply lock count, but some manual locking code did
not check that "already set" precondition and over-locked reply objects
set to ClientHttpRequest::al::reply by clientAclChecklistFill().

Current known leaks were probably introduced in 2021 commit e227da8 that
started supplying HttpReply to ACLChecklist in clientAclChecklistFill().
The added code locked the reply object correctly, but it was
incompatible with unconditional manual locks in three existing indirect
clientAclChecklistFill() callers (calling clientAclChecklistCreate()).

This change removes all known similar leaks and improves
ACLFilledChecklist API to prevent future similar leaks.
21 files changed:
src/DelayId.cc
src/HttpHeaderTools.cc
src/HttpReply.cc
src/Notes.cc
src/acl/ConnectionsEncrypted.cc
src/acl/FilledChecklist.cc
src/acl/FilledChecklist.h
src/acl/HttpRepHeader.cc
src/acl/HttpStatus.cc
src/acl/ReplyHeaderStrategy.h
src/acl/ReplyMimeType.h
src/adaptation/AccessCheck.cc
src/adaptation/icap/Launcher.cc
src/adaptation/icap/icap_log.cc
src/auth/UserRequest.cc
src/client_side.cc
src/client_side_reply.cc
src/clients/Client.cc
src/http.cc
src/http/Stream.cc
src/neighbors.cc