From patchwork Mon Oct 24 11:31:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555987wru; Mon, 24 Oct 2022 10:00:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5x4UYm5zCut0GrLn0jrwvR41ApbMxD0+iWJp24klw0PBVR3nRzRgsGY6qroIgnycNDZPd6 X-Received: by 2002:a17:902:bd02:b0:178:1a1c:889 with SMTP id p2-20020a170902bd0200b001781a1c0889mr34209990pls.107.1666630858720; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630858; cv=none; d=google.com; s=arc-20160816; b=V5trAqkEXMtqt7IaTMm9ReNGRAUHnY+AsHezPqHoWGlaMvHZvgg1b94QIWxFAlkGZO WLQWuLz3A2JFAEKGMyDYEaNiFaUpEZ9T13woJmM2yPCiN+jGFN5JFJ+MKQoapb0DjFgk BURFG4a0X9a4L5WAIXp2mZf7xeI6AgU3/HjeucxWcgiLOd2+SLr1yfyp/r/haQ1smKGq S1I8e4sSeE80LN1UB97DC/b9wZkA8pCjDkABb8/6vJf31h+rfSoZrJCgd0+0JS2pxix4 68EfszoqjJjnOSRl0zE7tMWbfyTzjyR2YDkM2eB+SL7DqYDWime0ZpXFmuhO7OtiHewz Vq/Q== 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=NQTjwj1okKal2zUZYOb+rFp+XT0RovHKzCW2HZRkkDM=; b=yrLzR9wLw4bvEa1Wwt9e5GSGXkJ0pLDkw5QiZkThm9QpeFcmB8f5+bjtI9l9pawJAj AYUBpwBHiy8fWGvl/y34HeDDWt6PDbsBSGFGgc+F7jd/59vy413cnOTFq8EuFveOrAdG gN6Uqa+pFhdLPq1zx7me7/2GquCwqPUEbpCHOP1A/sdtQsKf8dC2FgTBmxrr6M8BlCdP XAc+UrkHbYi1KyRN1eDxuLFWZztZfYyFgnhfcXW9aaGNgkgBcylRLJBTtA3d4JeIohI7 tIKj9DD1Mnyk2FJ8vBwPmiEjrgIRN9+XHwMK3mSrK/eSsYukFtmn+91PL0u0k60mGdAw Euaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PTsRZNKR; 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 h132-20020a636c8a000000b0045ceb2c2eb7si29113595pgc.760.2022.10.24.10.00.32; Mon, 24 Oct 2022 10:00:58 -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=PTsRZNKR; 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 S235156AbiJXQyP (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235449AbiJXQth (ORCPT ); Mon, 24 Oct 2022 12:49:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A15C2871B; Mon, 24 Oct 2022 08:33:05 -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 052A7B8119B; Mon, 24 Oct 2022 12:02:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574F0C433D6; Mon, 24 Oct 2022 12:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612940; bh=LYOZmQeizkuIeOn1+GAegEIME+ZYeJwyvA0+gG8HBBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTsRZNKR+TWM25qCStelVCGjmLX5RPJXOtzLrNjgdku3HaJzgg2XXaEsVPJBeMpNE urKFrrcg3uEaWZH/biM9Okcq+vjp9w1B5dxBwq0sufQbgNfvA+dec3vJj6WZBe0Qfq tmPYGcp2fuZMVxunKEExXFQEG2HpbJYrMZJJsjuQ= 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 4.19 177/229] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024113004.822883523@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747589119142405656?= X-GMAIL-MSGID: =?utf-8?q?1747589119142405656?= 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 f350faef044d..a9868e97db45 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -249,10 +249,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; }