From: Maria Matejka Date: Wed, 3 May 2023 16:59:52 +0000 (+0200) Subject: Fixed cold page cache leak X-Git-Tag: v3.0-alpha2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e998a434909b6ad5506c4b0084b7ad1ef3da2b1;p=thirdparty%2Fbird.git Fixed cold page cache leak The empty_pages pointer wasn't being propagated into the ->next pointer when more empty_pages were to be stored --- diff --git a/sysdep/unix/alloc.c b/sysdep/unix/alloc.c index 2205f1527..891a0e69d 100644 --- a/sysdep/unix/alloc.c +++ b/sysdep/unix/alloc.c @@ -282,10 +282,13 @@ page_cleanup(void *_ UNUSED) if (!empty_pages || (empty_pages->pos == EP_POS_MAX)) { /* There is either no pointer block or the last block is full. We use this block as a pointer block. */ - empty_pages = (struct empty_pages *) fp; - UNPROTECT_PAGE(empty_pages); - *empty_pages = (struct empty_pages) {}; - PROTECT_PAGE(empty_pages); + struct empty_pages *ep = (struct empty_pages *) fp; + UNPROTECT_PAGE(ep); + *ep = (struct empty_pages) { + .next = empty_pages, + }; + PROTECT_PAGE(ep); + empty_pages = ep; } else {