From patchwork Mon Oct 24 11:31:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430752wru; Mon, 24 Oct 2022 05:42:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78lJDuUjaeaDwEkddP7n6ZiTFEWMOGAzUfKHCmtjX5LtklHRNIPc/NnQUEKP37GjWbxdcD X-Received: by 2002:a17:902:db01:b0:186:9329:723f with SMTP id m1-20020a170902db0100b001869329723fmr10374150plx.172.1666615332698; Mon, 24 Oct 2022 05:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615332; cv=none; d=google.com; s=arc-20160816; b=b8hDEoUbgiA+HLhrMpxCrNKouDRUpEgBNfIsHrzLa2uIV5l9z8oTngADLPSlTFalGr V/Jdv2je8cAJPXADhjiVvgYxRhMhMMs/7e30RETIlkoprbdKZTUIcrMztO3nFd2/n0vs Kx42MIVefvYex2hGqtdGSs5EWrRp3Q6FMPLC0rSVQDV1f9UlcAuwuUNhZ5bgnDUYBobU Cz7jydJljGZ9/AWdkoEw05bZDqdxzNOPiSJbCwqd/fUN9pVSOETYK8ZQdjZ/lnTGzmq8 9U/sHcx0DFGCEpA9kLoqe4D4uDlSjj7P7S+BlAKoz5rv99pkciupYS8GTMCwn9hzJKhm d24Q== 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=kUoTzrRjyvRlavI6DWzzossrSHhbqyaQHSE4uFw4PRQ=; b=TzO9N3hVik7c5dpn/Ue/a7P9NDTAyx4qaTJs+pr6pdbLPzyNfSzpIrPtJl0wi9p+do lflvD7KOVXd2yi58tnNgB1ZBmmNsW9vJSY37y3Bu9h2qMorjU1n19cG1gH09WrlCVufn SLH8PBdehac2vumoDIG/5SKSQmTIPNCv/juAUx55uMPF36BJqtWrohtIo5TxtOY86nMI T+0K7+wRL36ohw1bYv6eY2Y1V1G0PMQE0hA2fdfI32jFtDNbx/mSHcZgkPrQ0HsZDEc1 f9iN3SEXxag8N/85X81qie7793eVETmXJJLVb/UROokp/e0feJPSyYIJVqHbs4NjXPfM EAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JkufbTLX; 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 w1-20020a63a741000000b00461c7200fafsi34411069pgo.320.2022.10.24.05.41.58; Mon, 24 Oct 2022 05:42:12 -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=JkufbTLX; 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 S233956AbiJXMcK (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbiJXM3B (ORCPT ); Mon, 24 Oct 2022 08:29:01 -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 95BB11007C; Mon, 24 Oct 2022 05:02:41 -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 E697261254; Mon, 24 Oct 2022 12:02:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01370C433D7; Mon, 24 Oct 2022 12:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612943; bh=qauSKgpxQD3mSoJYIZLLYiRX2nOUMjRG4equd7WLjdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JkufbTLXjpJJ3bnlLaWpPmH+mBKYodRi6+OcrqDBgX2/E8wJKp7PXfL02LPWG0eGI Y7bef4hp2L9tBl2c4O0jTUZlDEpNFMLv4FXZ3hghPqZ/Y0b4p9bKyA3fLuHtXguBcL smqUQIL6vtd3D+LvdpTh/wVv7JZTcuZ6ciXzKKJU= 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 178/229] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:37 +0200 Message-Id: <20221024113004.851952005@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 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?1747572839129813874?= X-GMAIL-MSGID: =?utf-8?q?1747572839129813874?= 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 a9868e97db45..b4e3db194140 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -526,8 +526,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; }