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 2F8D646D0A4; Tue, 21 Jul 2026 18:20:32 +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=1784658033; cv=none; b=N26eP+BN8ykRTnRyD1UVSfBzBGmKwL7uPEzfcpZ+R341UPOybUoFQR3XBPpOUuqYfGzLUbi73MfBXHiCHznRCYqukCsUZ1GaB8r2Bctxbmb5rvKcrPOLoQXs5CxrGIQxicuuCy4blqfQJVMiJbXljWO1R9h4Sbstf5Z6/H/fsDY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658033; c=relaxed/simple; bh=OZ+7bEf5UAiy8LLwG3sF/Uk79LzwehDh4PecOxU3kIA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NidNjjvk1IUB/kx/TsNkVPnlGj3z8Hc6ZAQqXyGHqt+wjSLBQ6p997RM8rom5va+TJz5xgCibJlTyxKctUgGwA9JGEth6OvFRf6w6ocUuF5kZONxYxhPocYfZFU8AbDoNQfF1sSJg4V9QJbl/9KNybvKAwadxwjnszYtFoKnZi8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vNBnHt7d; 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="vNBnHt7d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94D681F000E9; Tue, 21 Jul 2026 18:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784658032; bh=emLJQTxRW1f/M2VRBrtJaqoLsyPVPF4SKYZLrasBQQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vNBnHt7dVpdih3XX6gnVh7Y3yGClq+fyV/YVvWrPWiOwl8IXQfA+CNlcB/46mlAf2 mnNzkx3JPB26vHjaliqf4KCvTp9ZRJwf0MidavwfuQDQB35E8aZnYdkzBHrYZq2GyU m9SQPBRMtUO+aQUEupuaZUBW3SE0aUX7WXkrasiU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sechang Lim , Amery Hung , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 0991/1611] net/sched: act_bpf: use rcu_dereference_bh() to read the filter Date: Tue, 21 Jul 2026 17:18:27 +0200 Message-ID: <20260721152537.681741851@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sechang Lim [ Upstream commit adc49c7ba690c9b33b8392ec27397456b65d0893 ] tcf_bpf_act() can run from the tc egress path, which holds only rcu_read_lock_bh(), but reads prog->filter with rcu_dereference() and trips lockdep: WARNING: suspicious RCU usage net/sched/act_bpf.c:47 suspicious rcu_dereference_check() usage! 1 lock held by syz.2.1588/12756: #0: (rcu_read_lock_bh){....}-{1:3}, at: __dev_queue_xmit net/core/dev.c:4792 tcf_bpf_act+0x6ae/0x940 net/sched/act_bpf.c:47 tcf_classify+0x6e4/0x1080 net/sched/cls_api.c:1860 sch_handle_egress net/core/dev.c:4545 [inline] __dev_queue_xmit+0x2185/0x2c00 net/core/dev.c:4808 packet_sendmsg+0x3dfa/0x5120 net/packet/af_packet.c:3114 The other tc actions and cls_bpf already use rcu_dereference_bh() here. Do the same. Fixes: 1f211a1b929c ("net, sched: add clsact qdisc") Signed-off-by: Sechang Lim Reviewed-by: Amery Hung Link: https://patch.msgid.link/20260629154112.1164986-1-rhkrqnwk98@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/act_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index c2b5bc19e09118..284800b7d3c554 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c @@ -44,7 +44,7 @@ TC_INDIRECT_SCOPE int tcf_bpf_act(struct sk_buff *skb, tcf_lastuse_update(&prog->tcf_tm); bstats_update(this_cpu_ptr(prog->common.cpu_bstats), skb); - filter = rcu_dereference(prog->filter); + filter = rcu_dereference_bh(prog->filter); if (at_ingress) { __skb_push(skb, skb->mac_len); filter_res = bpf_prog_run_data_pointers(filter, skb); -- 2.53.0