Re: [PATCH] mm: workingset: fix NULL ptr dereference
From: Johannes Weiner
Date: Tue Apr 10 2018 - 08:43:41 EST
On Mon, Apr 09, 2018 at 10:58:15AM +0900, Minchan Kim wrote:
> @@ -428,6 +428,7 @@ radix_tree_node_alloc(gfp_t gfp_mask, struct radix_tree_node *parent,
> ret->exceptional = exceptional;
> ret->parent = parent;
> ret->root = root;
> + INIT_LIST_HEAD(&ret->private_list);
> }
> return ret;
> }
> @@ -2234,7 +2235,6 @@ radix_tree_node_ctor(void *arg)
> struct radix_tree_node *node = arg;
>
> memset(node, 0, sizeof(*node));
> - INIT_LIST_HEAD(&node->private_list);
> }
I have to NAK this.
The slab constructor protocol requires objects to be in their initial
allocation state at the time of being freed. If this isn't the case
here, we need to fix whoever isn't doing this, not the alloc site.