[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170627070626.GH29909@kroah.com>
Date: Tue, 27 Jun 2017 09:06:26 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Kees Cook <keescook@...omium.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Thomas Hellstrom <thellstrom@...are.com>,
Andi Kleen <ak@...ux.intel.com>,
Daniel Micay <danielmicay@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kref: Avoid null pointer dereference after WARN
On Mon, Jun 26, 2017 at 08:52:15PM -0700, Kees Cook wrote:
> From: Daniel Micay <danielmicay@...il.com>
>
> The WARN_ON() checking for a NULL release pointer should be a BUG()
> since continuing with a NULL release pointer will lead to a NULL
> pointer dereference anyway.
>
> The kref_put() case is extracted from PaX, and Kees Cook noted it should
> be extended to the other two cases.
>
> Signed-off-by: Daniel Micay <danielmicay@...il.com>
> [kees: clarify commit log]
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> include/linux/kref.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/kref.h b/include/linux/kref.h
> index f4156f88f557..82a2c225eae3 100644
> --- a/include/linux/kref.h
> +++ b/include/linux/kref.h
> @@ -66,7 +66,7 @@ static inline void kref_get(struct kref *kref)
> */
> static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref))
> {
> - WARN_ON(release == NULL);
> + BUG_ON(release == NULL);
I remember one complaint was that WARN_ON was "huge" and this bloated
the kernel code a lot. But then that got fixed up. Is BUG_ON going to
cause the same complaint again?
thanks,
greg k-h
Powered by blists - more mailing lists