Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7147349rwi; Mon, 24 Oct 2022 10:22:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FUmHYC+Vs1xxX4kLYdwht3BpaOFw02FikVZw10u17j4zDz65yRh6eeT8+In8ov6S+vWcZ X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr20937846edq.387.1666632165135; Mon, 24 Oct 2022 10:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632165; cv=none; d=google.com; s=arc-20160816; b=GUruf8Ck51KzsRizuyEZXkrpg+odd8JwrDhI4j6I9Rb/aPFqO3b2lRp7lcr1mc6mvt 7Iks8HcNwtXLZaTArCuhdQgJmz7WKsqCMIrke3azVE3vYg6oIXV/l+Z2Hj3jsQkpyWNj VdXVBo8bm5m6veBGYxTgnD3do67jikQZAz1Y7nWO13K6vbCEofavmGf9wk7Hl5QJ2lI+ W61I7iXxqAFjhJ1hPn1DHKtF/vrCHVlB+sMEBYXw8uv1wc+bKPXM6wixudepGhDjhha3 0YNoDPPeqYYUsK82xzsGBkMCSmYCfHvGqLdVYk0uWxpuluPGWpkD6JDzbLcS8UafGju2 bE8A== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg11-20020a170907320b00b00741a0c28f07si275069ejb.943.2022.10.24.10.22.20; Mon, 24 Oct 2022 10:22:45 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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; } -- 2.35.1