From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B52193EC830 for ; Thu, 13 Aug 2026 05:47:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786600059; cv=none; b=TC3CuQ5je1Bja7wJQ7SqsrO4kB1U3B8Hyo9LYZuefTybhyQXEhMvmvtB6laf2LW8fhfvvdYp3ANLkzLm3NIGfI/Nlr0RQiNSkGFYmY7Rg6qvF2R5kwbUR2JNXFMw+ZriysKIYnOAFJNJb3l7rvicbhJ9LX/D9mRzh0X96lJgB3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786600059; c=relaxed/simple; bh=21S1qZnq2KQIxbCTlIvk2KBTg6PbdZU54hPR6uEl4dA=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=SeghHcHUdVYpzeHS4dL2X3+gW564c4oSytvMoCHAXFmC5nY8DCDZRSY0q3FgipRqEE4+T7D4+kQUpbx6uNXzI3tWCaa93v2xwSaopEbOxeHEMQil67yV8x9ekEJBHTaEQRI4cuxx8eUDRf4YN2f3nU5yy1xnjUa5o6R0NIgL6lA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=doyensec.com; spf=pass smtp.mailfrom=doyensec.com; dkim=pass (2048-bit key) header.d=doyensec.com header.i=@doyensec.com header.b=dMSEAhKi; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=doyensec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=doyensec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=doyensec.com header.i=@doyensec.com header.b="dMSEAhKi" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-471eeac43bfso251773f8f.3 for ; Wed, 12 Aug 2026 22:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=doyensec.com; s=google; t=1786600055; x=1787204855; darn=vger.kernel.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=kJdVd9JEvLI+gAaAJA/YXYI/7MyW6Qd+/+zQWas02oU=; b=dMSEAhKiFqSD3nOjRkrxWi15OdNFqZnZ2xnc1RhS615WnYIfrOpkLs0Ag4I6ZviaND GRYhHCmt2aDXXphTuCmdTnzUPOx634Wn5bhxj8rXv2GZ9FJmGYWr2ycmnhr1sgHhgdEw 3SgdnFxWKL/NBqAb/13OvH9DPspFEZz84m6MR+Wh/Iz6zFOR12urbMldd/0sjbwQdlH8 HmkNQJxq0ll9/+ZGA5q2bKOz1NgPmmg29Zho80XIi6sePwAMso8mRPixnqD0XDfDpfIs Umy1JpzpUJv+i/ojn8m5Olf55jTJ1FZs0y9hODsIxf0dHGJojy3EVy64njkKwFzaGQV3 Mr7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786600055; x=1787204855; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kJdVd9JEvLI+gAaAJA/YXYI/7MyW6Qd+/+zQWas02oU=; b=Ef4mymc2Cy+pYcGiaaB+BjvG/OfYAcjwPglSTsKXnFYaB9FjNx1TPr/CWNl8GOnLq/ EpOvdlyHaLZhVo1McYY1/VFF2QJ8QUV45tA4x1yYspt+SliVcw8P5fbSNzpT4+ZdwyQ/ NhnYaayuj/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Received: by 2002:a5d:45ca:0:b0:47f:ddc0:602a with SMTP id ffacd0b85a97d-4815a01ba47mr2905789f8f.18.1786600054954; Wed, 12 Aug 2026 22:47:34 -0700 (PDT) Received: from smtpclient.apple (ip-88-212-19-42.antik.sk. [88.212.19.42]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4815a5af441sm3741295f8f.22.2026.08.12.22.47.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Aug 2026 22:47:34 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.4\)) Subject: [PATCH net 1/2] openvswitch: only skb_tx_error() a packet we are about to drop From: Norbert Szetei In-Reply-To: <8063260C-05C9-4997-B9B6-2135063C4858@doyensec.com> Date: Thu, 13 Aug 2026 07:47:23 +0200 Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Aaron Conole , Eelco Chaudron , Ilya Maximets , Steffen Klassert , Kuan-Ting Chen , Zoltan Kiss , dev@openvswitch.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <8063260C-05C9-4997-B9B6-2135063C4858@doyensec.com> To: netdev@vger.kernel.org X-Mailer: Apple Mail (2.3826.700.81.1.4) queue_userspace_packet() borrows the packet skb -- it only copies it = into a private netlink message (user_skb) and does not own it; on return do_execute_actions() keeps forwarding it through the flow's remaining actions. Its error path nevertheless calls skb_tx_error(skb), which via skb_zcopy_clear() does skb_shinfo(skb)->flags &=3D ~SKBFL_ALL_ZEROCOPY, stripping SKBFL_SHARED_FRAG from that live skb (skb_tx_error()'s = kerneldoc says "skb must be freed afterwards"). For a MSG_ZEROCOPY skb carrying page-cache frags, SKBFL_SHARED_FRAG is what makes esp_input() skb_cow_data() before in-place AEAD; once it is stripped a later local ESP-in-UDP delivery decrypts in place over pages the sender does not own -- an unprivileged page-cache write (the "Fragnesia" primitive). do_execute_actions() ignores output_userspace()'s return value, so any action after a failed USERSPACE upcall inherits the stripped skb. Move the skb_tx_error() to the flow-miss drop path - the "default" branch of ovs_dp_process_packet()'s switch(error), before kfree_skb(). The call has been here since commit 36d5fe6a0007 ("core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors") but was harmless until esp_input() began relying on SKBFL_SHARED_FRAG to gate in-place decrypt; only then did stripping it on a still-forwarded skb become a page-cache write primitive. Fixes: 36d5fe6a0007 ("core, nfqueue, openvswitch: Orphan frags in = skb_zerocopy and handle errors") Fixes: f4c50a4034e6 ("xfrm: esp: avoid in-place decrypt on shared skb = frags") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5 Signed-off-by: Norbert Szetei --- net/openvswitch/datapath.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index ae69b2cabab9..fff75c3eed11 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -285,6 +285,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, = struct sw_flow_key *key) consume_skb(skb); break; default: + skb_tx_error(skb); kfree_skb(skb); break; } @@ -601,8 +602,6 @@ static int queue_userspace_packet(struct datapath = *dp, struct sk_buff *skb, err =3D genlmsg_unicast(ovs_dp_get_net(dp), user_skb, = upcall_info->portid); user_skb =3D NULL; out: - if (err) - skb_tx_error(skb); consume_skb(user_skb); consume_skb(nskb); =20 --=20 2.55.0