From patchwork Wed Aug 17 15:06:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Pattrick X-Patchwork-Id: 12946129 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E09F6C25B08 for ; Wed, 17 Aug 2022 15:12:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240671AbiHQPMe (ORCPT ); Wed, 17 Aug 2022 11:12:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234140AbiHQPMb (ORCPT ); Wed, 17 Aug 2022 11:12:31 -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 ESMTPS id 1B7B99E2F1 for ; Wed, 17 Aug 2022 08:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660749149; 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=SszEhxH7LLMG8oKsOY7uQxS6RnNC5vm4S5xVreTS3Hk=; b=OKuKYKcxR9BWU56JoI8vCV/tW9a5X/YoK3H2YuOh/NLKSOu8xxxYRw27kQZuwqWMt352i1 hUrDoQeSJudNa2lO6qBOxOOriIVpincmq4TLWNLt6CRF9LThJf+CENjZo2cG/U9a9EBlER qA4rVA2ddz/I1XU6MeTmD2pH1YuXaTw= 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-605-Q6fpyfmCN5-4CMamYbaSuA-1; Wed, 17 Aug 2022 11:12:22 -0400 X-MC-Unique: Q6fpyfmCN5-4CMamYbaSuA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 930DE1019C93; Wed, 17 Aug 2022 15:12:20 +0000 (UTC) Received: from mpattric.remote.csb (unknown [10.22.17.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6DFD14152E2; Wed, 17 Aug 2022 15:12:19 +0000 (UTC) From: Mike Pattrick To: netdev@vger.kernel.org Cc: mkp@redhat.com, Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , dev@openvswitch.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/2] openvswitch: Fix double reporting of drops in dropwatch Date: Wed, 17 Aug 2022 11:06:34 -0400 Message-Id: <20220817150635.1725530-1-mkp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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. Signed-off-by: Mike Pattrick Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109946 --- Changes in v2: - Corrected bugzilla link --- 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 7e8a39a35627..ca22aa73c6e0 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; }