Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Subject: xarray-add-xas_split-fix-3.patch
Date: Fri, 2 Oct 2020 00:39:43 +0100
Message-ID: <20201001233943.GW20115@casper.infradead.org> (raw)


Testing today revealed a rather annoying bug where we can free an
initialised node back to the slab cache without zeroing it first.
That ends up creating a corrupted XArray ... whichever XArray
happens to allocate that node next.

From c53d4d2690db946f5710a39e6a6f67c5a46ff9a4 Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Date: Thu, 1 Oct 2020 18:22:35 -0400
Subject: [PATCH] fix xarray

---
 lib/xarray.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/xarray.c b/lib/xarray.c
index b573db455c43..eedb4b51c59f 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -271,8 +271,7 @@ static void xas_destroy(struct xa_state *xas)
 	while (node) {
 		XA_NODE_BUG_ON(node, !list_empty(&node->private_list));
 		next = rcu_dereference_raw(node->parent);
-		/* XXX: need to free children */
-		kmem_cache_free(radix_tree_node_cachep, node);
+		radix_tree_node_rcu_free(&node->rcu_head);
 		xas->xa_alloc = node = next;
 	}
 }
-- 
2.28.0




                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201001233943.GW20115@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git