From patchwork Mon Oct 24 11:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456448wru; Mon, 24 Oct 2022 06:34:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73UnK70PI7vgEbyst1z0pVQQPTqv4xbVFvxSr/LWEnAWMlN9b+T6/7xipwQVckCOuCluQb X-Received: by 2002:a17:90b:3e8a:b0:20d:4632:e487 with SMTP id rj10-20020a17090b3e8a00b0020d4632e487mr39192973pjb.78.1666618452596; Mon, 24 Oct 2022 06:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618452; cv=none; d=google.com; s=arc-20160816; b=g0o2Sm45PDNWiF0pMNNyIt3jvkP0Kesca3lUyNIkpof9Ky08YKlMjdm8vRU6mM32BU +LHG/T561f0SAnsYYfARIHEfaCxQbKgSRQStqBsbi3vq+STXpP/A19rx774a/YyfIEAY 23MEEwG51YO94P0izYhYt6brPvt9unFwdmcXEYBort508r9L09ZylJpB73kdphZTgIAt WYifOCiwdVjHJ1jIhUbggvHeHbKLu5FZRVBLTxAkK6HFLbs0RnaKGAcgdQ2oauoEnM1P MhuCZTgyEgy/dQPfN2sFlCLyUd6nuG1Ln+BetuwJKR0KPCOJJ0mIaGdZfda0h+4xCKIH GybA== 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=QToXYaZOVlSkJrvhBqcAuCEGL/Hz3A5QbX1urKxKmFA=; b=myE+KdElFiqYiRozFHt2RmtvCuxuDPC84P9cmgTCF8d+zMBNM/QrGeR0L7q1TFooek kmAjiCv1bcN0QbrTRYgt6xTml4p7/ae+tOmBf3twp80jyK7hKwH4CrsRH8bUrXZp7rZj qFowQ4U0la02BI7JifMW1dN2PX6lnbEWsVPXUz5VoljxxwmoKM98Wv3eYjsO9SgtvLa1 2HPmjluXli2whzSQjgdKFNxV1267Yb9/Mvy31KC82/ACR0su5pcIbQg+sytdwDf6Fumz 6+15BSlGVZw3+kClzKQwgxLEz4Jj1iwvZQhrRM9zbBuHa0LXZD2Yam9tdkou/wtXdsSB vlkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nAYP8GDJ; 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 b15-20020a056a000ccf00b00537d8aa3bc3si36811897pfv.200.2022.10.24.06.33.52; Mon, 24 Oct 2022 06:34:12 -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=nAYP8GDJ; 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 S232059AbiJXNVZ (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236324AbiJXNTz (ORCPT ); Mon, 24 Oct 2022 09:19:55 -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 28BB9A7AA6; Mon, 24 Oct 2022 05:28:47 -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 2F69E612F5; Mon, 24 Oct 2022 12:14:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43565C433D6; Mon, 24 Oct 2022 12:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613666; bh=gePGUbRyCmr1HqTy+cXj6xywnpe9R20ipRt3gOynQyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nAYP8GDJLHWVJsCaaRExdA6yGO2zundKYuYWgI0IGxUSywO5ElPwCGbf9J5Teqt4m qcvzI5Wo/mglyg9xsCKMOLkpjMvuo9uYw3a7Xe7E3led6VKa+aJ462bC0VGcQwf3CY Y46k+Nvl/OdlAdBFTJgXY2NV65ykwbkSv4vh8Sno= 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.4 193/255] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:43 +0200 Message-Id: <20221024113009.397443479@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747576110440901335?= X-GMAIL-MSGID: =?utf-8?q?1747576110440901335?= 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 4f097bd3339e..63f36d6cd3f6 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -236,10 +236,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; }