From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 64D3935AC3E; Tue, 16 Jun 2026 17:13:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629995; cv=none; b=G8Vcy+eXsqngeDPVPnl2ziCS2aLDdn0pGioyoeb2KWblUYuz2S0WjDw0ZCSJbx6fH2hXXc3SDBZa3371rfj7+kMNosnYd/plxGTri7+PFItmxHguOh4FV8FfYYEBPDoroolvd2yWhdV5U3vaJME7mn9B+DNyKWImm/UvhBOiPTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781629995; c=relaxed/simple; bh=69xB0RIA6J8WiZm4PU6o1hPPSBp7YJ+uWCYrsl1VveE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o8lgy4+9LOucT9F+kmJpdr+URgPNShIgGy1Fj0dvSJLWjfxcwe2fNaX9J3Wb4X6L9GmRcUlzwKYt+l1IaX5t2f4iYgLOd4CX93HZ3ak3nLnNCs6eM6q4ypyEg6TJ4EvNpl6jHTgLwleuAG24alR0DmICzGUocJx6uxmmP1irBo4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XuiBKBZA; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XuiBKBZA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73BFD1F000E9; Tue, 16 Jun 2026 17:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781629994; bh=riUW3cQYcjKlugpduwW50eCkVpyjCDH34vnrqwQajyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XuiBKBZAoDP3cJco4rltDUzwC6gf8zaF17zv/GFK04ntOoLiGtVhhYSakhU7aasf/ ElLiMcPqZ9a/C54yHubsA5F9aRgvwA2+Y131K9Rm7A3cSbSpzg28fXuSJQqqiKwCQV FGHestPA/+SxIbLGtBUY/DFzruDw0TqjiLk2moaU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Bommarito , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 391/452] net: hsr: defer node table free until after RCU readers Date: Tue, 16 Jun 2026 20:30:18 +0530 Message-ID: <20260616145137.451740497@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145117.796205997@linuxfoundation.org> References: <20260616145117.796205997@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Bommarito [ Upstream commit aaec7096f9961eb223b5b149abe9495525c205d9 ] HSR node-list and node-status generic-netlink operations run under rcu_read_lock(). They walk hsr->node_db through hsr_get_next_node() and hsr_get_node_data(), but RTM_DELLINK teardown removes the same node table with plain list_del() and frees each node immediately. That lets a generic-netlink reader hold a struct hsr_node pointer across hsr_dellink(). In a KASAN build, widening the reader window after hsr_get_next_node() obtains the node reproduces a slab-use-after-free when the reader copies node->macaddress_A; the freeing stack is hsr_del_nodes() from hsr_dellink(). Use list_del_rcu() and defer the free through the existing hsr_free_node_rcu() callback. This matches the lifetime rule used by the HSR prune paths, which already delete nodes with list_del_rcu() and call_rcu(). Fixes: b9a1e627405d ("hsr: implement dellink to clean up resources") Cc: stable@vger.kernel.org # v5.3+ Signed-off-by: Michael Bommarito Link: https://patch.msgid.link/20260513233838.3064715-2-michael.bommarito@gmail.com Signed-off-by: Jakub Kicinski [ replaced `list_del`+`call_rcu(hsr_free_node_rcu)` with `list_del_rcu`+`kfree_rcu(node, rcu_head)` ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/hsr/hsr_framereg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c @@ -112,8 +112,10 @@ void hsr_del_nodes(struct list_head *nod struct hsr_node *node; struct hsr_node *tmp; - list_for_each_entry_safe(node, tmp, node_db, mac_list) - kfree(node); + list_for_each_entry_safe(node, tmp, node_db, mac_list) { + list_del_rcu(&node->mac_list); + kfree_rcu(node, rcu_head); + } } void prp_handle_san_frame(bool san, enum hsr_port_type port,