Message ID | 20201027190406.33283-1-ldufour@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] mm/slub: fix panic in slab_alloc_node() | expand |
On Tue, 27 Oct 2020, Laurent Dufour wrote: > The issue is that object is not NULL while page is NULL which is odd but > may happen if the cache flush happened after loading object but before > loading page. Thus checking for the page pointer is required too. Ok then lets revert commit 6159d0f5c03e? The situation may occur elsewhere too.
Le 28/10/2020 à 12:11, Christopher Lameter a écrit : > On Tue, 27 Oct 2020, Laurent Dufour wrote: > >> The issue is that object is not NULL while page is NULL which is odd but >> may happen if the cache flush happened after loading object but before >> loading page. Thus checking for the page pointer is required too. > > > Ok then lets revert commit 6159d0f5c03e? The situation may occur > elsewhere too. The only other call to node_match() is in ___slab_alloc(), and the page pointer is already checked there. So there is no real need to check it in node_match().
diff --git a/mm/slub.c b/mm/slub.c index 8f66de8a5ab3..7dc5c6aaf4b7 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2852,7 +2852,7 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, object = c->freelist; page = c->page; - if (unlikely(!object || !node_match(page, node))) { + if (unlikely(!object || !page || !node_match(page, node))) { object = __slab_alloc(s, gfpflags, node, addr, c); } else { void *next_object = get_freepointer_safe(s, object);