[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1317932252.15807.69.camel@nimitz>
Date: Thu, 06 Oct 2011 13:17:32 -0700
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: Seth Jennings <sjenning@...ux.vnet.ibm.com>
Cc: gregkh@...e.de, cascardo@...oscopio.com,
dan.magenheimer@...cle.com, rdunlap@...otime.net,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
rcj@...ux.vnet.ibm.com, brking@...ux.vnet.ibm.com,
ngupta@...are.org
Subject: Re: [PATCH] staging: zcache: fix crash on cpu remove
On Thu, 2011-10-06 at 14:28 -0500, Seth Jennings wrote:
>
> + if (kp->obj) {
> + kmem_cache_free(zcache_obj_cache, kp->obj);
> + kp->obj = NULL;
> + }
> + if (kp->page) {
> + free_page((unsigned long)kp->page);
> + kp->page = NULL;
> + }
Getting back from my preempt tangent... :)
I'm not sure how free_page() can oops. If kp->page is NULL free_pages()
will rescue you:
void free_pages(unsigned long addr, unsigned int order)
{
if (addr != 0) {
VM_BUG_ON(!virt_addr_valid((void *)addr));
__free_pages(virt_to_page((void *)addr), order);
}
}
I *thought* we did some of the same for kmem_cache_free(), but maybe
it's just kmalloc/kfree(). Anyway, it's all good. I don't like relying
on the allocators to be nice when freeing NULL pointers anyway.
Acked-by: Dave Hansen <dave@...ux.vnet.ibm.com>
-- Dave
--
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