[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1632485642-20625-1-git-send-email-manjeet.p@samsung.com>
Date: Fri, 24 Sep 2021 17:44:02 +0530
From: Manjeet Pawar <manjeet.p@...sung.com>
To: glider@...gle.com, elver@...gle.com, dvyukov@...gle.com,
akpm@...ux-foundation.org, kasan-dev@...glegroups.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: r.thapliyal@...sung.com, a.sahrawat@...sung.com,
v.narang@...sung.com, Manjeet Pawar <manjeet.p@...sung.com>
Subject: [PATCH] mm/kfence: Null check is added for return value of
addr_to_metadata
This patch add null check for return value of addr_to_metadata().
currently 'meta' is geting accessed without any NULL check but it is
usually checked for this function.
Signed-off-by: Manjeet Pawar <manjeet.p@...sung.com>
---
mm/kfence/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/kfence/core.c b/mm/kfence/core.c
index 575c685aa642..9b953cfa7fee 100644
--- a/mm/kfence/core.c
+++ b/mm/kfence/core.c
@@ -802,6 +802,9 @@ void __kfence_free(void *addr)
{
struct kfence_metadata *meta = addr_to_metadata((unsigned long)addr);
+ if (unlikely(!meta))
+ return;
+
/*
* If the objects of the cache are SLAB_TYPESAFE_BY_RCU, defer freeing
* the object, as the object page may be recycled for other-typed
--
2.17.1
Powered by blists - more mailing lists