ANDROID: page_pinner: prevent pp_buffer access before initialization

If page_pinner is configured with page_pinner_enabled=false and
failure_tracking=true, pp_buffer will be accessed without being
initialized. Prevent this by adding page_pinner_inited checks in
functions that access it.

Fixes: 898cfbf094 ("ANDROID: mm: introduce page_pinner")
Bug: 259024332
Bug: 260179017
Change-Id: I8f612cae3e74d36e8a4eee5edec25281246cbe5e
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan
2022-11-27 10:30:33 -08:00
parent 2bd8e6670e
commit 23fb3111f6

View File

@@ -21,6 +21,9 @@ static inline void free_page_pinner(struct page *page, unsigned int order)
static inline void page_pinner_put_page(struct page *page)
{
if (!static_branch_unlikely(&page_pinner_inited))
return;
if (!static_branch_unlikely(&failure_tracking))
return;
@@ -29,6 +32,9 @@ static inline void page_pinner_put_page(struct page *page)
static inline void page_pinner_failure_detect(struct page *page)
{
if (!static_branch_unlikely(&page_pinner_inited))
return;
if (!static_branch_unlikely(&failure_tracking))
return;