linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/slab: restore IRQs in kfree()
@ 2019-06-13  6:56 Dan Carpenter
  2019-06-14  5:03 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-06-13  6:56 UTC (permalink / raw)
  To: Christoph Lameter, Kees Cook
  Cc: Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton,
	linux-mm, kernel-janitors

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(-)

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/slab: restore IRQs in kfree()
  2019-06-13  6:56 [PATCH] mm/slab: restore IRQs in kfree() Dan Carpenter
@ 2019-06-14  5:03 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2019-06-14  5:03 UTC (permalink / raw)
  To: Dan Carpenter, Andrew Morton
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	linux-mm, kernel-janitors

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
> 

-- 
Kees Cook


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-14  5:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13  6:56 [PATCH] mm/slab: restore IRQs in kfree() Dan Carpenter
2019-06-14  5:03 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).