From patchwork Mon Oct 24 11:31:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527542wru; Mon, 24 Oct 2022 09:01:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oJrBVpmhDrVVNcnTpLNoBP3kvMl3MUy0lcuepif3a/KjHA4p5AJwhKwCOeTRYeaIn7Of8 X-Received: by 2002:a63:8643:0:b0:46b:2bef:338b with SMTP id x64-20020a638643000000b0046b2bef338bmr28939364pgd.357.1666627260625; Mon, 24 Oct 2022 09:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627260; cv=none; d=google.com; s=arc-20160816; b=prVCYAlA6O128wOCq5rCWlFv1Hm1rFuUOIijdpZWgmUMPuo5tWX/XYzCOtYmyQA0oK jWnd1KDveVpAl1wKefxP2GpaCH6MAh9gtYnibK8yZgkJJBo5Oe1pWu0ZkqFB5LR0SxNM nd0sc1sBADLgVzD4SIlMVkvlzCapoJtVvBfI+1ekoukftGqcaP+PhO+mt2PdpJ3+W3js k8sY/kucoKaa/AOGe3KTZd9CYoHUqfmMWPd632tp8Zvr5Q6RjCTMChwpjrVwVeDiuWDl AP6xRSitgMyGdra2T2FcOrA8wBYDyt04GirhozLxcS45aEt6VwHXTrEcetASBi9/TTor hNAw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vaBewzWYI4Dv2QgP8WbbgMMxroCYVPJPRYhz6sAjoCc=; b=Qy4Ry+LHEH8jb3bJ7wTI/TZgEHvV5thkn5YkMN18t97nSrEfZjnQY3TNlV4PN3PDya YAI9mg+gg/N7lq9qWVOdVj4r29BNO66ZJYaNcjxZ/Pbf3EtgU355R411eSCK2m88YZvk Ucf5wLUrHZ8YmGQXhvW29laFqC9Svtjz5K1cnDHAOMhQnPA3rPBd2i8p8UHOXBn+tbQJ qH53lSSWfZIeBhcD13J0LaZGgrX5J1tqsIGxJsBtH7HANfcNrjZGuv9GxJMLXnqimSEe wGnuQQpfyAKcWzuW7jQhUCrgBwkAL4Koxk5P8LJjawETqOYeH2T5WrYPwgoqxpqhCvcM 4LQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z0Cfh5fl; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oo16-20020a17090b1c9000b001fd8713170csi11535700pjb.179.2022.10.24.09.00.25; Mon, 24 Oct 2022 09:01:00 -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=@linuxfoundation.org header.s=korg header.b=Z0Cfh5fl; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbiJXP6g (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:36 -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 X-Spam-Status: No, score=-7.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585346499038901?= X-GMAIL-MSGID: =?utf-8?q?1747585346499038901?= 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 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, struct sw_flow_key *key) upcall.portid = ovs_vport_find_upcall_portid(p, skb); 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; }