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. Bug: 259024332 Bug: 260179017 Bug: 240196534 Change-Id: I8f612cae3e74d36e8a4eee5edec25281246cbe5e Signed-off-by: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Richard Chang <richardycc@google.com> (cherry picked from commit 83b784c3d716ce03ab6b2a9ee178045b1952147d) Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user