[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1409101640350.5523@pobox.suse.cz>
Date: Wed, 10 Sep 2014 16:42:06 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: Andrey Ryabinin <ryabinin.a.a@...il.com>
cc: Theodore Ts'o <tytso@....edu>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
LKML <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] mm/sl[aou]b: make kfree() aware of error pointers
On Wed, 10 Sep 2014, Andrey Ryabinin wrote:
> > I of course have no objections to this check being added to whatever
> > static checker, that would be very welcome improvement.
> >
> > Still, I believe that kernel shouldn't be just ignoring kfree(ERR_PTR)
> > happening. Would something like the below be more acceptable?
> >
> >
> >
> > From: Jiri Kosina <jkosina@...e.cz>
> > Subject: [PATCH] mm/sl[aou]b: make kfree() aware of error pointers
> >
> > Freeing if ERR_PTR is not covered by ZERO_OR_NULL_PTR() check already
> > present in kfree(), but it happens in the wild and has disastrous effects.
> >
> > Issue a warning and don't proceed trying to free the memory if
> > CONFIG_DEBUG_SLAB is set.
> >
>
> This won't work cause CONFIG_DEBUG_SLAB is only for CONFIG_SLAB=y
>
> How about just VM_BUG_ON(IS_ERR(ptr)); ?
VM_BUG_ON() makes very little sense to me, as we are going to oops anyway
later, so it's a lose-lose situation.
VM_WARN_ON() + return seems like much more reasonable choice.
--
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists