From patchwork Mon Oct 24 11:31:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421366wru; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IjmlAEb4QF7jloQraal0jDl8RJbW4Vg0LYGG3p0G91+vnXsB7MjM9eCDuOSc0KHsM3PPf X-Received: by 2002:a05:6402:501b:b0:459:df91:983 with SMTP id p27-20020a056402501b00b00459df910983mr29131552eda.85.1666614021750; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614021; cv=none; d=google.com; s=arc-20160816; b=mYDShLsVNdOMZ1v1wdSfWqmj/DDqO2MOtkqTI5Sm4cIH+JrbPq3eBNPI+MGXPEVHmb zkKGrXTFowqbq88nfyXthFOB8xwTZSkuIFRg6ficJ3D6t9nhuyAY4Ekyy+pGFQrkxW7L w/1vQJW/wZDpx0ySCTSZIdy+Ikm/RCdkHuTgrRjs0n3VIRxPigT6fzxxJr0tAKkfdXaN 6LrTRQTFy0YLmIy1JVJjDBjbC1X8UjJ6yWTeCfpPWzYjODxK/8Zqz0jTtkUXtv3swIXR Ko08xdvSRCp5muvoFRnmrFPWUAaO1TML04+0QDOxyHAovIOhykFTtxsgyNzEZ5uj3NtE 5u3Q== 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=iJgKrqMAHLDOosWai9oZGHxyTmfi8AHkDf3qEj21waA=; b=IwZHFrnnojlU1S09dcnbdTb/SM/lC33n6AukAxicUwX5g9gzwKjE+Nx86egBdgmEIZ TTYCx2FLUnAGDNyTRTSx+Othq9R01dK8aokMt21LAp6mmpWTqLhZXZVAc1lMVKk+jDw+ WHlK2q/utXiQoEdu2uaRlaxGcaFo8EI1Pkq/oEzfKaZ3fh3BwEukWIfdwlIQfwiSmHwk 57fxaXDpsvC8mIgWGBNy1e1VrCOC0k3FqZzEOLd+05kqETg7lKJ78zapnN1vIcvmTFQL 0C/yVaUSrB+oRiijRO4PwiHW4HVmpTOK2bDFTjq91NCsVkqJiLL0/eU94Nn26E8NE7jL 5Aig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yC4nDoDc; 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 eb10-20020a0564020d0a00b004537a3c4982si31382239edb.601.2022.10.24.05.19.57; Mon, 24 Oct 2022 05:20:21 -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=yC4nDoDc; 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 S232939AbiJXMNs (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232860AbiJXMM7 (ORCPT ); Mon, 24 Oct 2022 08:12:59 -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 0A0B6BFF; Mon, 24 Oct 2022 04:54:33 -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 5477E612C3; Mon, 24 Oct 2022 11:53:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64064C433D6; Mon, 24 Oct 2022 11:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612433; bh=T1RzVjYOnfsNgB+jghQGsmTf4DSzu07LR8BVos8WFwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yC4nDoDcChHXyCW70fXrotDveOrj3iQhI3DSika2TKySqv4SNdT4gW8YtyALvBp1Q b9af1PgrDoU4tFPlqbOSlyKT0nUMIwkbYVcF8lKkHljax6FxbR1/rt3NHfftooyNR+ PQGFQLAHaM76hmJ7iZ9g7GZEflNL4Uqs/UwhxolA= 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.14 169/210] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:26 +0200 Message-Id: <20221024113002.443916899@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747571464559850332?= X-GMAIL-MSGID: =?utf-8?q?1747571464559850332?= From: Mike Pattrick [ Upstream commit c21ab2afa2c64896a7f0e3cbc6845ec63dcfad2e ] Currently queue_userspace_packet will call kfree_skb for all frames, whether or not an error occurred. This can result in a single dropped frame being reported as multiple drops in dropwatch. This functions caller may also call kfree_skb in case of an error. This patch will consume the skbs instead and allow caller's to use kfree_skb. Signed-off-by: Mike Pattrick Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109957 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/openvswitch/datapath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 42616aca0ce4..8319628ab428 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -553,8 +553,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, out: if (err) skb_tx_error(skb); - kfree_skb(user_skb); - kfree_skb(nskb); + consume_skb(user_skb); + consume_skb(nskb); + return err; }