From patchwork Mon Oct 24 11:31:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403234wru; Mon, 24 Oct 2022 04:51:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cWf0WaswfngH6NaffPkPXwQs9pwdFaZyedVidDUx2Nl5/w3eWEaye/5vUl4AQF3hOYZz2 X-Received: by 2002:a17:90b:4b88:b0:20a:cbb0:3c86 with SMTP id lr8-20020a17090b4b8800b0020acbb03c86mr71263890pjb.207.1666612296958; Mon, 24 Oct 2022 04:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612296; cv=none; d=google.com; s=arc-20160816; b=0lhhbGaQyV9s9l/49gNV/9J3bN18nyLap/0bnJm0X2HBZ3M9GN6ru8f7n0gWLCstMZ i/Z2P027DipyXdxgcQVTa7PI6wcLDW8zTP+ElYNAbRL99LdNdq/osD+lAeMwwi/tAysK ULvcdmuJ31vh3aEDn0PCDcN+egSh0gG3D2HqXII8UOBm7r2Zr0+esnSLr84jByjXQXUd qL2bS9BLyrFOHlmWCINhILZqMrB72ZSVBb1rnSoK6usMOJeTD71kBgk0fjsYbOTV/xLe 8DOE2n2kPLd6qfP3B38BQIa2gml0TMLLdU8ZPBniaqkPRTWSSSZnIbdhSSuncc4D+wYE TsjQ== 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=9GTDI8cCfglyavCiVv9wJl4zf6CApydZg0cVG4sFHec=; b=kEAoRQ3/JgZn2nIR9EBgAdyIGP4CyCMZo0lZU/wlkUn3tMIFGjZNgFD31G0zlKdRs/ 4lwIRM8GynsdEXX5LWI5RHHY/9opYkS+EYEUVf2q13VEV/Sy6GYRZELglDIf5TWW71jW E4OhB9F7LDqiPnTK7HHbv2Jv0mefBLTneTMtZiwK73HUdVRK6v95nP8vJfCVs1CqW4p2 94l77DOXAdLCNmnsHlBHPWnUXznrXQW220g5SONjfrA6aFOOFX1BxpI5Lxo2ry4tq5Wa iIDGhEZC0bCERGEA24CyNXL6jJ8hUB6XXWoXKYUa1v6KVKdP0lN3Xg62JaDG/XCi0Ufq UHDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mFqP+1pG; 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 h9-20020a170902f70900b00186b46df624si1034397plo.424.2022.10.24.04.51.23; Mon, 24 Oct 2022 04:51:36 -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=mFqP+1pG; 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 S231917AbiJXLvB (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiJXLtM (ORCPT ); Mon, 24 Oct 2022 07:49:12 -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 142E96DAF5; Mon, 24 Oct 2022 04:43:51 -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 C9A9B61297; Mon, 24 Oct 2022 11:43:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFE0AC433D7; Mon, 24 Oct 2022 11:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611831; bh=s8XvSJ0CBvwlnj1YP3pu0XkLAMDkv8P0FO3gc3W4WDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFqP+1pGoT1KZyvJAPiu1AyjCVgwpXfjDJgcswYL/hn/6WR3d6uuxr1fbldycHuEX tcw32/ezHZGjPzl2jd4Rz1n/6Y7p6NPscvl9Gb+RXI8oNxePqC/wJkbe4zEowZsWDB cRb3egMvidEh7OpDb0P/zgh4oqfm97GFvqXrpEw8= 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 128/159] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024112954.180634319@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?1747569655702992889?= X-GMAIL-MSGID: =?utf-8?q?1747569655702992889?= 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 ab318844a19b..10423757e781 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -555,8 +555,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; }