Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp885026rwi; Wed, 19 Oct 2022 04:18:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4waTZPg6PvmfMNO6ThdPonSAsDsMbc2m4QgYp0OQ7t0MmA97avF/Kjg6yS/gE3xkmpFpf7 X-Received: by 2002:a17:90a:1c1:b0:20a:e745:bc30 with SMTP id 1-20020a17090a01c100b0020ae745bc30mr46142840pjd.131.1666178305320; Wed, 19 Oct 2022 04:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666178305; cv=none; d=google.com; s=arc-20160816; b=nMBR4pGA3mHD81DQbWbuJoEptP4aU9tsps6uRw4htf1C3RpbLPak4iNywjl2LyQEem WKZTQ8TOaOPzHzOj8hD8Ik+rSE76PdL5cJsdOzfbve6AoRXRsCMFe7gD2I2x80HmEnxm n3xI7VMDBXPdX+rbLJ2dCCKon6E6+rSTblX20HU2paaTMUFiDJz2f5EQ6LogAnzrgNKn flNZPlUjsFG6i8RGLq1IEbEEGIKpe4v1OzT75C3Rw4eMSCuY51xG5JwVcE3yMasqy4CX p/hqaY2ALtc3zZVBtf4xwl8+UGZgPnid3JVuGFm/pEgPdm0yPfWByhlnRd1ryEt190kn /Wzw== 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=S1nWCQsmt68xM25gLOO415/wUHsVxU+co+x8EPIfX5E/nBKAljzTqISk7Aslpuy5ho +jHCfylFkUx00j7f8ifaaCPsIpB+iyVPluwkVcZs0fcxoqP+jxY8pDSI4wNgGBDaOxDf BSRhXoDmLfon8c/N9OYR6YzhIdDBHWEmzV/Wfb1CsbFZ/r922mzOQSR2E0zp4ntFLRrL WU/ZcuMZ9bwVSFA+st1qjT37HJANmWF2W/zkvI1+D6NVJe7nZ2p6K067N2CNI3JiyfUg yeZDJBnqqzjUHTyhcoxOb1Gt1FtR5L+9wTmTxFQyP2EU+cTr0qAgw8L1zFYF86pXWTCj RrhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o84krziJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a17090aa41700b0020ae29877besi15951094pjp.20.2022.10.19.04.18.12; Wed, 19 Oct 2022 04:18:25 -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=o84krziJ; 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 S233990AbiJSLFq (ORCPT + 99 others); Wed, 19 Oct 2022 07:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234881AbiJSLEL (ORCPT ); Wed, 19 Oct 2022 07:04:11 -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 B02D215201C; Wed, 19 Oct 2022 03:33:30 -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 DA85B61880; Wed, 19 Oct 2022 09:08:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB619C433D6; Wed, 19 Oct 2022 09:08:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170515; bh=YIPJ25ERBUQJfRKFkqLFPqinasOAti3V9lF/D6mb+20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o84krziJgvAJSl08T/Atb2MlDX5og1S+e7s2+OMx0zZBD0uOQCa2luG9TbZ+Du39I m6ctXuRZYrC1ZvI1U6v4q9oSQS393nUPu72bDVIh5n8JRe5zOtSinljirQsadOdV8A 0PEaRJ1YrCi1fjY0zkL49no2QFFEZjGBUIy5/AJM= 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 6.0 685/862] openvswitch: Fix double reporting of drops in dropwatch Date: Wed, 19 Oct 2022 10:32:52 +0200 Message-Id: <20221019083320.248592352@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 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; } -- 2.35.1