]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: openvswitch: fix skb leak on flow key update failure during ct
authorIlya Maximets <i.maximets@ovn.org>
Mon, 27 Jul 2026 18:18:31 +0000 (20:18 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 Jul 2026 00:42:33 +0000 (17:42 -0700)
ovs_ct_execute() always steals or frees the skb on failure while
ovs_flow_key_update() does not.  So, if it fails and we return right
away, the skb ends up leaked.

Fix that by breaking instead and letting the common error handling
code at the bottom of the loop to free the skb properly.

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: ec0d043d05e6 ("openvswitch: Ensure flow is valid before executing ct")
Cc: stable@vger.kernel.org
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Reviewed-by: Aaron Conole <aconole@redhat.com>
Link: https://patch.msgid.link/20260727181851.306076-3-i.maximets@ovn.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/openvswitch/actions.c

index 0118fe3b35e4bd30ae07b9f1ad1924b8f18ce8db..dc5ff859f114511eb68f45c09e870e687e5d8b48 100644 (file)
@@ -1380,7 +1380,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
                        if (!is_flow_key_valid(key)) {
                                err = ovs_flow_key_update(skb, key);
                                if (err)
-                                       return err;
+                                       break;
                        }
 
                        err = ovs_ct_execute(ovs_dp_get_net(dp), skb, key,