From nobody Fri Dec 19 16:01:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDEC3FA373F for ; Mon, 24 Oct 2022 15:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbiJXP6h (ORCPT ); Mon, 24 Oct 2022 11:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232164AbiJXP5w (ORCPT ); Mon, 24 Oct 2022 11:57:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83CF02EF72; Mon, 24 Oct 2022 07:52:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4FE22B8119E; Mon, 24 Oct 2022 12:29:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A802BC433C1; Mon, 24 Oct 2022 12:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614560; bh=KOyJZ8EAro8rxOf+fthAnt3nxSGIZ91HYgHAzMiTWno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z0Cfh5flAW0M503sNHW2HfRaXQK4hfIA48xw4JnCUdxJDuZfjifmNbdAzFxmp4hen prI4seNUKzIuYF/xOj9a3GCawbUOnWoDflTa98OOijG6KLO1GE7Qz84VIpH/JrYduY r4oru7Sjwho0ZjiSJJnt4oEszKn9+jm2nqyUI/a8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Pattrick , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 307/390] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:44 +0200 Message-Id: <20221024113036.067859854@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Pattrick [ Upstream commit 1100248a5c5ccd57059eb8d02ec077e839a23826 ] Frames sent to userspace can be reported as dropped in ovs_dp_process_packet, however, if they are dropped in the netlink code then netlink_attachskb will report the same frame as dropped. This patch checks for error codes which indicate that the frame has already been freed. Signed-off-by: Mike Pattrick Link: https://bugzilla.redhat.com/show_bug.cgi?id=3D2109946 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/openvswitch/datapath.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 9d6ef6cb9b26..4d2d91d6f990 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -241,10 +241,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struc= t sw_flow_key *key) upcall.portid =3D ovs_vport_find_upcall_portid(p, skb); upcall.mru =3D OVS_CB(skb)->mru; error =3D ovs_dp_upcall(dp, skb, key, &upcall, 0); - if (unlikely(error)) - kfree_skb(skb); - else + switch (error) { + case 0: + case -EAGAIN: + case -ERESTARTSYS: + case -EINTR: consume_skb(skb); + break; + default: + kfree_skb(skb); + break; + } stats_counter =3D &stats->n_missed; goto out; } --=20 2.35.1