From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (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 EDB8A433027 for ; Mon, 27 Jul 2026 18:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785176349; cv=none; b=fr2/K5k9LuKzQlR+FZJfdmM5WTvX5dC79CvXFKy3nwnyjhmmNYh8Iev5RQXZMsoh+f0BuhSWCvwNseT7A1tvWsPNyz8onRd5mdPkx6smzpoeV2JKNPxsnfcMaPQS1FUOoH8h1OtMIpo5UsXgoo0HGIoC9ylP8oQabtZV+QgXwlA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785176349; c=relaxed/simple; bh=LCFB12z6scQ+ae2dL7dad5g7aifAW8FuFUG06zQCfWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RPszabNqO78S/ZKLnBHJFemtyiAZQe85ddIu4u7IYcxXYX/cmR3nbEvfyGLtWDkDiYYNuKtfgMtgj/1Cs1/1REVH5MVtWGLAEStTtDAPPu3fhNx+59Wi2sl7hxpYtYxh57UFwEhpFSJZDxwt94hzKZeJm8Mbj1m7I5a7BP5aHYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f68.google.com with SMTP id ffacd0b85a97d-47de008b020so133603f8f.1 for ; Mon, 27 Jul 2026 11:19:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785176346; x=1785781146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=4fi0WlZV11A3w9tLPVBtDdauyjxFE6/gukfGCcACwmM=; b=owJLxEvCboJoo6UynoBiZ/qQi/uli9uHYTTcnF28Xi6mTD0Es8lfH1ov48OwdOfyQD H1/fg6KDUgtxK8BSk+8p3Wf9kBEdzlFiLVRpza8xywIG3jHeIi2A/Lfu/QhCFwoHT868 PBi8GGzGnAKw11lDq7+HC5Yuwz/Q/3zPMXsLLH3vqdZ6Nokj86IFMhWavDzPPVMQ344H bh7oqs4OKcZ4RTqz0hyKRflmrMBzj6ULws7epulT2AXzrEMDX2zvQW8byKoJQonO0dqN oe5Miro4/2+ju+4bWteTKpRxW7tK2B1AwTgv/5BF7tJ8cd1yPYzAkKERcnKusDesMYmO jCRQ== X-Forwarded-Encrypted: i=1; AHgh+RqWko8WYYvNUea0HZQ1tPt52hy3mlyQx3OA2XdYksRWDqc5xSB/d16cnLZElSHWrRiVEMgLGRUJksrp2qM=@vger.kernel.org X-Gm-Message-State: AOJu0YysMGJAlHhC8n2sqDBAg5cCJuZFWsJwGBeEuvmCLVoSfJxXA/jw emtcbaOduzz5u3UWiEIeCEnNEhNC9F2X/Axw8oL2Ov+W2S9JQ9Cbdmba X-Gm-Gg: AR+sD13dKBzar3gxyH14R9IsTyrXeCwdkNhtkLm4L5jROVA9nO4nLTzlnvbw8ArgfW0 MpKg3B0/9KS0/8Jav/EtzoKzWpZ2k75GTnKvvnIpsVc+ilfYDhP2rBkvZoUeyZRKQDEuiGv8FCg /8ED7D0oNSZha+GL9DinzQ65atiYf8cxcEhR0rGQCIPOMVUCwafnnRSwgJNz64a/s5DL0WNJOte f4dsshHx5FkvRT8SQs+vGL+oNEIMATeEznEHsARslphglYqsdQ519L9U5G/uemp5dcdaZhsEUVs fmMndmy7n+0HhrrHaZEMiF0WFpcEVnlMNTLk5WlZ4AdT0tpBxTKwlPpp7Qd9C4yKBf8m7nQdjCm 8rhjrK4+s03en5T+9KNSOT57jj6jGueR/CWFCLa1FA69hz1toxYt3H3xf+FUUcHbYom1fQLQyfk iqK2D6Mmlj8ob/8DAkSYNa6VwpJcnj6iG5Q3BN+JJANQg= X-Received: by 2002:a05:6000:2c0f:b0:47f:9275:b20b with SMTP id ffacd0b85a97d-47faf5b4abcmr684092f8f.26.1785176346147; Mon, 27 Jul 2026 11:19:06 -0700 (PDT) Received: from im-t490s.redhat.com (78-80-108-129.customers.tmcz.cz. [78.80.108.129]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c52fc0sm51042855f8f.23.2026.07.27.11.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 11:19:05 -0700 (PDT) From: Ilya Maximets To: netdev@vger.kernel.org Cc: Aaron Conole , Eelco Chaudron , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , dev@openvswitch.org, linux-kernel@vger.kernel.org, Ilya Maximets , stable@vger.kernel.org Subject: [PATCH net 1/2] net: openvswitch: fix skb leak on flow key update failure during recirculation Date: Mon, 27 Jul 2026 20:18:30 +0200 Message-ID: <20260727181851.306076-2-i.maximets@ovn.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260727181851.306076-1-i.maximets@ovn.org> References: <20260727181851.306076-1-i.maximets@ovn.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit do_execute_actions() returns right away when execute_recirc() fails on the last action as it assumes this function always takes ownership of the skb when 'last' is true. But when the flow key update fails, the function doesn't free the skb and it ends up leaked. This is a very unlikely scenario as it requires the packet to become unparseable by applying a set of actions on a previously parseable skb, but should be fixed nevertheless. Reported by Sashiko. Fixes: 971427f353f3 ("openvswitch: Add recirc and hash action.") Cc: stable@vger.kernel.org Signed-off-by: Ilya Maximets --- net/openvswitch/actions.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 513fca6a8e8a..5653b6642e10 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -1108,6 +1108,10 @@ static int execute_masked_set_action(struct sk_buff *skb, return err; } +/* When 'last' is true, recirc() should always consume the 'skb'. + * Otherwise, recirc() should keep 'skb' intact regardless what + * actions are executed on recirculation. + */ static int execute_recirc(struct datapath *dp, struct sk_buff *skb, struct sw_flow_key *key, const struct nlattr *a, bool last) @@ -1118,8 +1122,12 @@ static int execute_recirc(struct datapath *dp, struct sk_buff *skb, int err; err = ovs_flow_key_update(skb, key); - if (err) + if (err) { + if (last) + ovs_kfree_skb_reason(skb, + OVS_DROP_ACTION_ERROR); return err; + } } BUG_ON(!is_flow_key_valid(key)); -- 2.55.0