Skip to contentSkip to conversation

mm/slab: restore IRQs in kfree()

PATCH In review Dan Carpenter 2 participants 2 messages Jun 13, 2019 – Jun 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/slab: restore IRQs in kfree()

We added a new return here but we need to restore the IRQs before we leave.

Fixes 4f5d94fd4ed5 ("mm/slab: sanity-check page type when looking up cache")
---
 mm/slab.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/slab.c +3 -1
index 9e3eee5568b6..db01e9aae31b 100644
@@ -3745,8 +3745,10 @@ void kfree(const void *objp)
 	local_irq_save(flags);
 	kfree_debugcheck(objp);
 	c = virt_to_cache(objp);
-	if (!c)
+	if (!c) {
+		local_irq_restore(flags);
 		return;
+	}
 	debug_check_no_locks_freed(objp, c->object_size);
 
 	debug_check_no_obj_freed(objp, c->object_size);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 lines · Dan Carpenter

We added a new return here but we need to restore the IRQs before we leave.

Fixes 4f5d94fd4ed5 ("mm/slab: sanity-check page type when looking up cache")

Oh yes! Thank you for that catch! Andrew, if you haven't already, can you pick this up?

Thanks!

-Kees

Quoted 23 lines
---
 mm/slab.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/slab.c +3 -1
index 9e3eee5568b6..db01e9aae31b 100644
@@ -3745,8 +3745,10 @@ void kfree(const void *objp)
 	local_irq_save(flags);
 	kfree_debugcheck(objp);
 	c = virt_to_cache(objp);
-	if (!c)
+	if (!c) {
+		local_irq_restore(flags);
 		return;
+	}
 	debug_check_no_locks_freed(objp, c->object_size);
 
 	debug_check_no_obj_freed(objp, c->object_size);
Signature · 1 line
2.20.1
Signature · 1 line
Kees Cook