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 B83693AAF69; Sat, 17 Oct 2026 16:54:07 +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=1792256048; cv=none; b=ogvkb3YUOXQpl7lRr0OEJ0BO8XUIb9bJQ/Fh3YsNuhLCRmv8VKco/e1eeS5DhUUxNlgkI7Sl2224Ca+eU1B9MvIaqVks8U0sZ+F4uV2gc3ypWwO5sVg4jj+Qo/+xJ9kmG+He8/J7zaCLI5rLsTfGxIoIjrIYHwPXQC0iFFafwro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256048; c=relaxed/simple; bh=HJ+O2KhAl8WPS/dshtrTWQx/yvzvuA3npiNH48K2z4o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WH5WSPrjJDoSfNTHBZlNT0po5WPod70+bRcYGoL6dWBfo7bQbNWx6KulWjTRSPMgDjXnN2zZr0lRjVJFgbcb3wbwxPdv6jxflZbQaqK9i32rrCaOomkSBS1UtYId0VrGUMsh7Kgir7HL6rXUCyyd0PaDGbNJ6gU8NEkOp1bO16c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fNdV7J0O; 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="fNdV7J0O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEC001F000C5; Sat, 17 Oct 2026 16:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792256047; bh=nWy58lszbG+cOATf2amOFZ+bBp0VJWL72q5gJ9RgWCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fNdV7J0OLjC3qpatL4cWsIuQITgeZSrpKeyEMZxF/NF/TYweR7MDQKbTtMZdJliNz 0QaionMyj/i0LRMq8G47dXHdV7/jfSaU0QNF9eVPm+w1lHAuY0WFDAgs/aEDmdWX4U JXx84u2195JUWBOewqc8XxGywpt92ubffTdCfYJo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xuanqiang Luo , Jamal Hadi Salim , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 0106/1674] net/sched: act_api: release all action references on NEWACTION failure Date: Sat, 17 Oct 2026 17:39:38 +0200 Message-ID: <20261017160433.870007129@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@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: Xuanqiang Luo [ Upstream commit 478eb5abb51931a152abab068f8a717b7ff480fd ] When a batched RTM_NEWACTION request replaces an existing action, tcf_idr_check_alloc() takes a temporary reference on it. If a later action fails to initialize, tcf_action_destroy() uses strict release semantics to clean up the actions initialized so far. For an action bound to a filter, the strict check returns -EPERM without dropping the temporary reference. This error also makes tcf_action_destroy() return before releasing subsequent entries. Any new action initialized between the bound action and the failing entry is leaked together with its reserved IDR slot, preventing reuse of its index. Use tcf_idr_release() to drop each reference held by the batch without rejecting bound actions. This allows cleanup to continue through all initialized entries and preserves the module reference release when an action is destroyed. Explicit action deletion and flushing retain their separate bind-count checks. Fixes: 55334a5db5cd ("net_sched: act: refuse to remove bound action outside") Cc: stable@vger.kernel.org Signed-off-by: Xuanqiang Luo Reviewed-by: Jamal Hadi Salim Link: https://patch.msgid.link/20260909070336.32979-2-xuanqiang.luo@linux.dev Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/act_api.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index b00d0b0215f84..2954324f12308 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1144,19 +1144,14 @@ EXPORT_SYMBOL(tcf_action_exec); int tcf_action_destroy(struct tc_action *actions[], int bind) { - const struct tc_action_ops *ops; struct tc_action *a; int ret = 0, i; for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { a = actions[i]; actions[i] = NULL; - ops = a->ops; - ret = __tcf_idr_release(a, bind, true); - if (ret == ACT_P_DELETED) - module_put(ops->owner); - else if (ret < 0) - return ret; + /* Drop our reference even if the action is still bound to a filter. */ + ret = tcf_idr_release(a, bind); } return ret; } -- 2.53.0