From patchwork Mon Oct 24 11:31:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405152wru; Mon, 24 Oct 2022 04:56:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vsUUfY1qGeaEggwvqcKCct0CBSEdVSQlD7/PhybT2v7JQGiRzJ53nb9y/Fzk1GipY1Dkb X-Received: by 2002:a63:2a8b:0:b0:46e:9fda:2171 with SMTP id q133-20020a632a8b000000b0046e9fda2171mr18449222pgq.106.1666612587663; Mon, 24 Oct 2022 04:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612587; cv=none; d=google.com; s=arc-20160816; b=nGO8AgEbHNf9ZhWbG0ywFocc7y2f4fDgOyaOoMGjw7sv53/Z1PQsA55qSTZqQkaAtE OXbvo0mtJY/gacPxrQs+pt6hsgsiMf3xv9f65ltUL/czQRwh0dZCfSidAfeR9J9i0c5L TYTAAaXLedCD+gfH4E4KHxgoAk7UpUJc4ZNSd/nSV1F1byCAOtpbQOm3xvjihqasyktu wpig4MRLj9HAukDAHyuoT6op30tnvotQr/ZO9KqdSmjq03nAtPoxOKODXWaDohzFhO2Y 9a03XQBS9z7VwGUdzunJjqlCtbCNIZAXba5l41ydHTTag2P6hIFNj4GNnsTsmmXIM1kW Fm4w== 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=nodavt5HM21GwxkXp5a38ynfdrL/+8KQRo2sT2v1V7o=; b=ReJh2SHnqxOgIWT/xtR6smPWIe4If/aYbgkbV7PjNy18WmHvMqYN5NRm987JWF12He 4qTymP9lFKjijJF/B4yIUUUO/PaHxYDWTAeG2AAwAWdLP34oQF5bALr9RnHRy1xP79KS 4Ym/xZNppcVo8VAueNdXSoBfQzP/WmCbcDko32Cu5my6T2wFgAqQ/zqQSLJCZk/kmM9g Hx6QgqOaTpS+2OZswMSw5pDAQV09bkMvZjbJKfHMPPvqUs3FHpypAWiViygur13f29iq 7tMW0o8OspXtd/qN6u+OwAX3m1u7ZZBk4BNT9VTDfOsai3zeZkyt0jCRsr9g7DiNPvEW 5e4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q3wOD8oA; 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 x12-20020a056a00188c00b005410d1ea0e5si41527564pfh.14.2022.10.24.04.56.14; Mon, 24 Oct 2022 04:56:27 -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=Q3wOD8oA; 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 S232242AbiJXL4D (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232336AbiJXLyZ (ORCPT ); Mon, 24 Oct 2022 07:54:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFF567674D; Mon, 24 Oct 2022 04:45:27 -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 E62E7B8119A; Mon, 24 Oct 2022 11:43:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A066C433D7; Mon, 24 Oct 2022 11:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611828; bh=0s+cvBR7eFaJ3V6V+p+oT1WB4JNdE2KcaYWAypo4Oqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3wOD8oA3UCWtlTg1CetNx5u+7ntfw2zkNccQqt+n+pXi9ZzzBZPjg/5YQyg9Ogq7 IOy+Hys44iTpYNpB/MNKha1dX4wdqHz6gvjI+FzdrLRDjy5I/0POhYIsqDyQ9a50Y0 MVYBbESRFwN7SRrPsklT29PTGUgbgzDSRghtX/WY= 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.9 127/159] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:21 +0200 Message-Id: <20221024112954.142168057@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569960836490051?= X-GMAIL-MSGID: =?utf-8?q?1747569960836490051?= 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 c28f0e2a7c3c..ab318844a19b 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -278,10 +278,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; }