From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02B854266AA for ; Mon, 29 Jun 2026 15:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782746563; cv=none; b=TRuiuJ8uKfbQmpGsnmrBbw3tWrgm4Nj1OtNnQAvX1oeJn1kv6LZ+bibX+i4EJDvxOdYYTRgZPqsSuSmQSiq85Llc2G6ac/I9DYp8ILseRmD9TsYhXt7qmQ95rMqndIn0HQxstpJqM6IUKa47Dr8rLJPp77KN0UhwrFD3DDFlQxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782746563; c=relaxed/simple; bh=rjKBSN0vNiwTEb6foof7iMVAfUBnVtSMDzWYMvRIais=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VbFWLXdsbmiwBuXHw87vSKwJzBHEJDve6r8YNqPJdEYYK8io+a1HQhb6VB7EKTCgU0gTODh0uv6VCfXGs3/zRE9l4Z6kcLJl7mAcmxgIb13UGoN9y3ALKTfGIHVYrZDyNKWEVgl40NK5Hv9MXQnO1fFkP/C4wqN73LXS+tKq6iU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=kDKQBArW; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="kDKQBArW" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=M6iR2qrUY3lKFFhhpreIimEDASDPW2AVk/qsJWmgcHE=; b=kDKQBArWTBErvdn6lVZwgItM6J G62SHu1j97tzY7OXR5LFx4MmbnL2gsqM5Njes4h0SW7M8IWkMrkkPUIyoDi7mqjb//Nm6jAIfZ8D3 +ig1qjM8e3wnm7TxtNlfulp8JkYJByfdBAEqPZ/JqTjnpYUs0BR2L8ih0EeRtagAuNrmwvEWsCMmj 3yr15qtUY0fy5IwPwIqtnGpycII9+iZHdYy1veJT4b+uYJ/DHC0Ec0/Z1wVEMg+WY/21NbPwTsBUR lTT8NJ75xywbeFcS+KL1Au09zxnfXeTFB0vfi4Z7KEYC4gVgh2xcJIvUvt1+a6LyLbqJDtQV7QGAc eMKcOrdw==; Received: from [38.23.173.23] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1weDon-0000000F3JA-12k6; Mon, 29 Jun 2026 15:22:41 +0000 From: "Liam R. Howlett (Oracle)" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, "Liam R. Howlett (Oracle)" Subject: [PATCH fixup] maple_tree: Fix dereference of rcu type Date: Mon, 29 Jun 2026 11:22:35 -0400 Message-ID: <20260629152235.1629785-1-liam@infradead.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260629144145.1572283-12-liam@infradead.org> References: <20260629144145.1572283-12-liam@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When getting the slot, the rcu type of the slot needs to use rcu_dereference_protected() to ensure no locking issues. Signed-off-by: Liam R. Howlett (Oracle) --- lib/maple_tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Andrew, Please apply this fix to "[PATCH 11/18] maple_tree: Add bulk parent set helper" to avoid type complaints. Thanks, Liam diff --git a/lib/maple_tree.c b/lib/maple_tree.c index eb7f32081b65d..f1b9c9b32bd42 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -525,8 +525,10 @@ void mas_set_parent_slots(struct ma_state *mas, struct maple_enode *parent, for (i = 0; i < count; i++) { unsigned long pval = val | ((start_slot + i) << shift) | type; - struct maple_enode *child = (struct maple_enode *)slots[i]; + struct maple_enode *child; + child = ma_enode_ptr(rcu_dereference_protected(slots[i], + mt_locked(mas->tree))); mte_to_node(child)->parent = ma_parent_ptr(pval); } } -- 2.47.3