From patchwork Sat Oct 22 07:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106543wrr; Sat, 22 Oct 2022 01:38:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mVQVPuBN1/t2+XCtB8+qPMNy9VfxkHHj/en8TCWJJBPBvBaEBRnJMs5clMlBRRxSW9JhL X-Received: by 2002:a17:906:8a4a:b0:78d:5ff6:7507 with SMTP id gx10-20020a1709068a4a00b0078d5ff67507mr19069795ejc.194.1666427894246; Sat, 22 Oct 2022 01:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427894; cv=none; d=google.com; s=arc-20160816; b=k6/8+hpKBeF7VooebtOEZSaaZqlerji1ltspXlV9ybkuUAc4OveVj9Fd6cqaA951ap K/zANGs34v4sv8RsF9+n0szuj5aAioL1m+Gjw7dMAU7avp8G61fQTeC6C9AX07Ph6z5M JtRkH4+ndUbecLj1Cpw1MkqQ1w8mkANRPucArDvuaahn8j8jhxFFQ83YqGuVUoWgmM1t 0BUTC930jtMEvx3GaWGP3bcaEXv+XRwTbMIbnqVAjDmwGiWOsbQWThCG+JWont894e84 dL9Qm/lEJ6U0DvgC7cLwbr4NYA8im6MkDJ1SXfwsM1axi05sVs+oc/5/isk/jwO1Ud8c eLog== 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=s2JYHE3jzH5G/wVhhmK7HeNfmDBc7ddkfQJqVQ/4540=; b=QZtSfkJuCzCXzX78JL5NbcnMdEQp6me1aMG1LVNpMA7FMKXOkmXu6htwK5lBmwador eP/wl1MgpDhpPDUJCNxRzQnAJmuid7rxJH7yCq+SXNwZeAfY+XwcKTXH7lFwBDn4lANi M2rNONmeaHrfvoIBtqYobEsJcFj3ENT4+CxlRDdv9qkpqFzRoufX+2+dlV+tUIXFl+zR a/ms6Lm9vgt4wc8qvqM7sn8cdKKnZD6cVBWpYJbujpB6PAhRawuABZMo7hQloCxrssLU i++CcKRCGNTR0cQoUl3NUe0a+t1O1xbtykPOrqplefFMGslzb3kk6s4qNV+xZs0r6P1n qDxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=grFDLCm+; 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 g7-20020a1709065d0700b007316ac034a1si18839966ejt.831.2022.10.22.01.37.41; Sat, 22 Oct 2022 01:38:14 -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=grFDLCm+; 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 S234127AbiJVIeF (ORCPT + 99 others); Sat, 22 Oct 2022 04:34:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234327AbiJVIa2 (ORCPT ); Sat, 22 Oct 2022 04:30:28 -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 23BBA2D083A; Sat, 22 Oct 2022 01:02:36 -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 B26D9B82E13; Sat, 22 Oct 2022 08:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E4BEC433D7; Sat, 22 Oct 2022 08:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425713; bh=YIPJ25ERBUQJfRKFkqLFPqinasOAti3V9lF/D6mb+20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grFDLCm+K4jFQPVXID7HwcI0Uo1fFcl+A9KMHu0ecqMUDlhbQBTz9Ws8+/1e9s5wM A07psv6vHoX6tSILoX4G6ZIYosgRymq5a1aNT7niMo5KuXm8dls8bP5X4+8uEYo440 sdwA8RlXao0YrpGdGk+zpgM/7B4PegBVExhzPivU= 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.19 561/717] openvswitch: Fix double reporting of drops in dropwatch Date: Sat, 22 Oct 2022 09:27:20 +0200 Message-Id: <20221022072523.192986693@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376295164831122?= X-GMAIL-MSGID: =?utf-8?q?1747376295164831122?= 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 6c9d153afbee..b68ba3c72519 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -252,10 +252,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) 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; }