Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3986852rwb; Sun, 9 Oct 2022 15:21:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ubYIKXq+qvVBmY4oNQ/RCBlqXqTwG1LJhRZ4JvFilCLgwL1Lby8umD3dxxPZZ2Q0QKDB5 X-Received: by 2002:a05:6402:f94:b0:459:42d7:ea9a with SMTP id eh20-20020a0564020f9400b0045942d7ea9amr14801636edb.392.1665354069767; Sun, 09 Oct 2022 15:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665354069; cv=none; d=google.com; s=arc-20160816; b=WbLR3jYVYYNqYHhPRxUSaWPx/k9CVIW7ATDAFXYUnjg/u7LU86zZVnv7qjbAjF9e8A oOOa56YRX9lHDgfMwh3/X1UgS9/zm2lL6iVxP7TcswjY2d9nOMf7CttxMEVcWqEqmhyp Fsf6RkvYulaMLuKlvB5fZbiMwgmlBju15BK3lIcx85pqUaAu+O0pN3T9S+8H4yqJ//7d 660ShQOK/tL+L1StEt+YeI+TJxGo6F+ly5zOcO7oFUmwrhEWg1HzxttMc0MoqMM58Iwm 1fychaTWXAa/DbaG0UAzS7pmvbP4+1hiUwRdF15RDqIimLTDE/yJFxVhSYygmCTnEJjt ENtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=s2JYHE3jzH5G/wVhhmK7HeNfmDBc7ddkfQJqVQ/4540=; b=O4Txtv0QdLdCJdIPYecCDI2lo+/trkDhNwmjkyfC56iZWd5S88G1S37+OS2e7l7DWm RqHqpDfIq+xkxbx/82kCVEQsYYYgJNOQbpBUQq1FeupFK0F5Btw9nbC+qTMAvToVa+Wm omtWZjvTCOrlDBuHNTHixiTR2qUYAU+QuGbOz2wXETOSTvBokCaAn11jxDfqVuoXbkXB Iv0osEKifY8vxHxLNv6rnm7vnjPujQhFfIFHUHpfhki7reODI9DCx6o3xCL8XrQ8zrL+ 2FyMXK7ySpwoy9SJ1Uybx/eqpSowip67AS1DmHmlZSp5asP8HvqxQG1zsu7TrwhpSY9+ 58mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TcM96o9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv13-20020a17090760cd00b00782e27026c7si10655834ejc.17.2022.10.09.15.20.44; Sun, 09 Oct 2022 15:21:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TcM96o9W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbiJIWJU (ORCPT + 99 others); Sun, 9 Oct 2022 18:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbiJIWIv (ORCPT ); Sun, 9 Oct 2022 18:08:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8822529358; Sun, 9 Oct 2022 15:08:29 -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 dfw.source.kernel.org (Postfix) with ESMTPS id CB65B60CEE; Sun, 9 Oct 2022 22:08:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BBA5C4347C; Sun, 9 Oct 2022 22:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665353302; bh=YIPJ25ERBUQJfRKFkqLFPqinasOAti3V9lF/D6mb+20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcM96o9WnEPy60NEuifmL9Rb7nI5dyLaKrTsFrkKvgIJe05M1+dpaxckyvg6BlTll j+jpv3eFXlDX+bXWIHqvdpDavkqOK8nPrJjYNRjbhVKo+ThfjgLIGgljQxlAY4VTsr 2/nZ4urmbFKO5sodnBKLOjgoXZevj4luKHphSn13gWr9ZoiSlqGRP1UTIf8+S2zaCn cZgY+ju6KtO7p7C7DgGhNSNxd+nKRERcHemzsPuSHNGwv1PvOkhYq9rD8FzI5Ietrs Tj0IiDs0snbUNUNdCvELf78yen7UNgQtuhC+ii19wenHPW8exxVWEX2rDHhsoBbGkx l+B6Oo4K+dwww== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mike Pattrick , "David S . Miller" , Sasha Levin , pshelar@ovn.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, dev@openvswitch.org Subject: [PATCH AUTOSEL 6.0 09/77] openvswitch: Fix double reporting of drops in dropwatch Date: Sun, 9 Oct 2022 18:06:46 -0400 Message-Id: <20221009220754.1214186-9-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221009220754.1214186-1-sashal@kernel.org> References: <20221009220754.1214186-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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=2109946 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 6c9d153afbee..b68ba3c72519 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -252,10 +252,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) upcall.mru = OVS_CB(skb)->mru; error = 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 = &stats->n_missed; goto out; } -- 2.35.1