Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp582645imn; Thu, 28 Jul 2022 09:33:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1GGMUw1VqT3gOX+hJYTyIKKVTV61mFJr2q2JpZCFgtFUAYTleqOIGEMAk8ZReXHPCsxqA X-Received: by 2002:a17:906:478b:b0:72b:5cd6:3f50 with SMTP id cw11-20020a170906478b00b0072b5cd63f50mr21730734ejc.514.1659025979878; Thu, 28 Jul 2022 09:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659025979; cv=none; d=google.com; s=arc-20160816; b=swZ9epmIYmGnULld17f1zLkT4F/dgMdskaTgtIfa3c9B91BTTsErWEt5eZ+Uzige81 6n7xMRg8tLDUttodJZgldF+bl9mKnMCZAID//3yP5nOzQTVpUC+qajO8y1dCMAA0gr+8 j1ceRBpsw939pn0paL2uk2PjMYjHRjO/qRbDU8ky9OmK3yssKOOMKsSft/FH0xU/4TsW D+gVaHCkJRYL26l8Qc/ddCQQjHggvdpLSvcB9gC7qEkhJULtjrJv5jtthAASRRFeNJm6 irShBI1L1Uzfc692MgOy/QOyQRKjQxJ1vy5oX3LAB9uUU0SYtNqJmpyE/haZ4wacQWqH vXdw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=MRkkBYKQp9oZk2da5EZBbCrPfbUp3tpj2MKHxygzUhg=; b=MR7CFMJzrpldj2UGlbvD5mFvW4M0KTrCPbxjiQ63cQZ43Ra1fl15lhi3pcfsgSIuF3 L64zijnAYebUDEvFqO3zi8nGycMSfu50SxAHldueO4+KsvwlWofQ1KKAkq4aX4LKM4Oi bVmJKgTErmov6Ce7Dkqv2RSqB+BGGeSVUQhrjSfXlgDVY/a6IyTKd8Wf4pxSRNVhuJs2 pFwHcWkD9abe0s5g2m6hVCfr6DBUihe39JcXRNlIM7a7X+Sp83uwIfPZE3AlSyaJxZI5 hZd2jCoYiWSmalt3ZVRKu5OXsm/IMw0jnhWspNtHai4nbkinyO5zMPR9mdOraxDUpOsQ GVlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cz7pWuNP; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a056402268100b0043bf03b720fsi1211417edd.27.2022.07.28.09.32.35; Thu, 28 Jul 2022 09:32:59 -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=@redhat.com header.s=mimecast20190719 header.b=Cz7pWuNP; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231998AbiG1QNs (ORCPT + 99 others); Thu, 28 Jul 2022 12:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232066AbiG1QN3 (ORCPT ); Thu, 28 Jul 2022 12:13:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 76E006FA19 for ; Thu, 28 Jul 2022 09:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659024794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=MRkkBYKQp9oZk2da5EZBbCrPfbUp3tpj2MKHxygzUhg=; b=Cz7pWuNPsk9m/Ae7JoWKJpwHjYN578rLj8pv8hbmpG5PY3dvTeJfnpx+m7INk0ey0mt0lj QYAXFFVxuSGuMT7k5TwqLkmseR3G1Dc1vDkKlF/YRIsY6QViHNJjkebHllJfDzrIYd2FHw W3aWdE7svQUaCp/xoUyhN92SHti2yws= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-247-NvNJMH7cM-aUgzJnPGvSSA-1; Thu, 28 Jul 2022 12:13:08 -0400 X-MC-Unique: NvNJMH7cM-aUgzJnPGvSSA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 66DF58037AA; Thu, 28 Jul 2022 16:13:07 +0000 (UTC) Received: from mpattric.remote.csb (unknown [10.22.33.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4836A2166B26; Thu, 28 Jul 2022 16:13:06 +0000 (UTC) From: Mike Pattrick To: netdev@vger.kernel.org Cc: pvalerio@redhat.com, Mike Pattrick , Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , dev@openvswitch.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] openvswitch: Fix double reporting of drops in dropwatch Date: Thu, 28 Jul 2022 12:12:58 -0400 Message-Id: <20220728161259.1088662-1-mkp@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 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. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2109946 Signed-off-by: Mike Pattrick --- net/openvswitch/datapath.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 7e8a39a35627..029f9c3e1c28 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -252,10 +252,20 @@ 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: + fallthrough; + case -EAGAIN: + fallthrough; + case -ERESTARTSYS: + fallthrough; + case -EINTR: consume_skb(skb); + break; + default: + kfree_skb(skb); + break; + } stats_counter = &stats->n_missed; goto out; } -- 2.31.1