diff mbox series

mm/slab: restore IRQs in kfree()

Message ID 20190613065637.GE16334@mwanda (mailing list archive)
State New, archived
Headers show
Series mm/slab: restore IRQs in kfree() | expand

Commit Message

Dan Carpenter June 13, 2019, 6:56 a.m. UTC
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 mm/slab.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Kees Cook June 14, 2019, 5:03 a.m. UTC | #1
On Thu, Jun 13, 2019 at 09:56:37AM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Thanks!

-Kees

> ---
>  mm/slab.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/slab.c b/mm/slab.c
> index 9e3eee5568b6..db01e9aae31b 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -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);
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/mm/slab.c b/mm/slab.c
index 9e3eee5568b6..db01e9aae31b 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -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);