From c5c050bef0a091380f893f1dac5f7fa123ac6c85 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 14 Jan 2021 12:10:17 -0800 Subject: [PATCH] Item cache might free null page on alloc error The item cache allocates a page and a little tracking struct for each cached page. If the page allocation fails it might try to free a null page pointer, which isn't allowed. Signed-off-by: Zach Brown --- kmod/src/item.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kmod/src/item.c b/kmod/src/item.c index 9fb08463..f4c725d2 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -345,7 +345,8 @@ static struct cached_page *alloc_pg(struct super_block *sb, gfp_t gfp) page = alloc_page(GFP_NOFS | gfp); if (!page || !pg) { kfree(pg); - __free_page(page); + if (page) + __free_page(page); return NULL; }