From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793210019; b=PtuVcTCYTSAmuVoIIF9fAD4AfGT2TbbPQjvEvBz5aBNgn0pIFgkQNzaKG1zO1TbRe/xu 9MdXDQE48NiC56YfCX1fvq+utP4/zwqd4AWasuK8rpeK8jrpCTaPPr0ciH67LPJ2HwzVu N4fuTLvEs4ZnK/jiBMoX3gG8HSZJvUB71va1Phq1Q83UfQZ3SyNml5ST7UVhm52BrbEy5 8vn3gmcMDlNu9rbldzfTXnz3f8dUrpg8myz0wYqZ8z3b2Me4rWDNlmxmyHUTC9q4XMvyS LRiv0X7Z2yzlxuxFPHCiFOwRFw0QFjTuInI9425ObLn5VL4heQJFKgeTcuW+eToZZtg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793210019; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=xHODMfOiil3nRHr/pPDXxqr6cIfmhieMvixqcltdqzE=; b=In9JqpXSA9Q/h6blJNISWIMR6+J6vpf7t22r9ChX+ErVEDU+SEO7ZCT1hqz3VZC7gjjp AwoQQdu0Hv6OCWUAdxVya6PMvYt3KEB90TyHiLomqRg0T8WFIo4B444qnrT6rj7GYSok6 ZAspHYvKW4tVBgWJ3XC8tBlA4QKt6k5LZRccZmAV/6NmLv6WaaEF4/MB85T8lBsios6oa zO/LMkxZpwyDTrKETWxu9xNTHRE1/L+es3PIg/WJoHq0eanuF349yVuGnFirnvaRxZbGr Mt9dK+vuS1K7iWf7ViHPxqCyIlpFQOdzNYeCmdU/7h6lUqdA8hl0/wQ51UvKdpYf2QA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=N8HzziOW; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E923606A31E; Wed, 28 Oct 2026 17:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=N8HzziOW Received: by smtp.kernel.org (Postfix) with ESMTPSA id B194E1F01828; Wed, 28 Oct 2026 17:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793210019; bh=xHODMfOiil3nRHr/pPDXxqr6cIfmhieMvixqcltdqzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N8HzziOWF0i41IAJREpsHJy1yi0gDsu7SqBtXEYYfpslcr+m4uOHsHYefUEkIUuii kFZpakEzU2HvB+YmVHyQc0VYSVTJ6ehziNxUtV7iOQ3IU/Fo+lFRsVELDgAT+/5c5b rfoQuEUV84pqsj91CoMtED7EwZfQ/vZbU5IilnDY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?J=C3=A9r=C3=A9my=20Jean?= , Simon Horman , Paolo Abeni Subject: [PATCH 6.6 046/168] net/sched: fix use-after-free in __tcf_action_put() Date: Wed, 28 Oct 2026 17:59:42 +0100 Message-ID: <20261028165944.179703032@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261028165943.089486480@linuxfoundation.org> References: <20261028165943.089486480@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jérémy Jean commit 7b16eb911091aae237a8673da94e4dfb9cd21d54 upstream. __tcf_action_put() decrements the reference count before decrementing the binding count. Another thread can free the action between these operations, causing the binding-count update to access freed memory. KASAN reports it as: BUG: KASAN: slab-use-after-free in __tcf_action_put+0x327/0x340 Write of size 4 at addr ff11000000d46420 by task tc-put-pause/64 Hold the action IDR mutex across both counter updates and IDR removal, keeping cleanup outside the lock. Fixes: 16af6067392c ("net: sched: implement reference counted action release") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Jérémy Jean Reviewed-by: Simon Horman Link: https://patch.msgid.link/20261008181348.527035-2-Jeremy.Jean@oss.cyber.gouv.fr Signed-off-by: Paolo Abeni Signed-off-by: Greg Kroah-Hartman --- net/sched/act_api.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -372,9 +372,10 @@ static int __tcf_action_put(struct tc_ac { struct tcf_idrinfo *idrinfo = p->idrinfo; - if (refcount_dec_and_mutex_lock(&p->tcfa_refcnt, &idrinfo->lock)) { - if (bind) - atomic_dec(&p->tcfa_bindcnt); + mutex_lock(&idrinfo->lock); + if (bind) + atomic_dec(&p->tcfa_bindcnt); + if (refcount_dec_and_test(&p->tcfa_refcnt)) { idr_remove(&idrinfo->action_idr, p->tcfa_index); mutex_unlock(&idrinfo->lock); @@ -382,9 +383,7 @@ static int __tcf_action_put(struct tc_ac return 1; } - if (bind) - atomic_dec(&p->tcfa_bindcnt); - + mutex_unlock(&idrinfo->lock); return 0; }