Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6806668rwi; Mon, 24 Oct 2022 06:24:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IGHb256jgdRtmRKRMBHXLxyK2DoWuqaDFCnPjqwHOF582U6dNZivLmCzyjxXQdL4wO6XJ X-Received: by 2002:a17:907:6eac:b0:78d:ce9c:3761 with SMTP id sh44-20020a1709076eac00b0078dce9c3761mr27239886ejc.738.1666617857437; Mon, 24 Oct 2022 06:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617857; cv=none; d=google.com; s=arc-20160816; b=03Q0oRl2ixo5tw2GNBbup21k8fbwU1dJF9hudMBcmzvqQwKt0wDgsV9CvLUR//i/jY 1eTIZ0BiYWdZrgZy3fXQLvycn0U1lvxj23DgPQGNtLTEdPIznT8k8N6hMAn/mZrAXxta zz5c0mZfRWZTrJkgPWW6Z0XNljDWNSHkR/BSDmqu/QmV57T21BVDPzYox6npy1JoE3x6 tEDIagZUFoNcJ8EgEYK5QBfvtoJCA8ffU7AdR8n+f5B5EkMed5uArGfestTXQBe9Nnz2 /d04zzAWiwaZVFSASVlcLtYEuN56z2JaO6D23Y8OdH5eYu3ZYxuSfjg4izMVIObpHxEs VgAg== 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=IzvbIhC6o0jgM2WbEsNYvNCX3tw9NXqhMv0b1hxbZNY=; b=r6TAm0N+/kY6rL26KSPaFEWaGyms9ztaRbdYJN5/u5cqs7B4gc+bdWbGWAdhqUEUgD cbgDbbh6/3Xy8VxuNRgjrLBb7L8n56CtYlI+PrWesiZ/Agr2jhpZtTYCT2gSP9D+IMNm gR7tqkPRLj9utD7MX61W1hJOGI3gfYJdVzgT4+tfTLOzfWkTOTWxl9HNxRr3CccbB4c6 XazAz9lHGh65khvRp4XCc8UVC057DTDnce6TOVX2I8QwJuqFynIFTZuibu2LAHGfRy5U ZxP6slT+INv3y71au9qdvtvdIYSX7lr3cS3gSpSfdIwADe7AECW9c3/a2ScfQbDK5X9K Mg7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hiKIzA1z; 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 b21-20020a056402139500b00448d387c327si24108740edv.181.2022.10.24.06.23.51; Mon, 24 Oct 2022 06:24:17 -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=hiKIzA1z; 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 S233096AbiJXMS6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233095AbiJXMSH (ORCPT ); Mon, 24 Oct 2022 08:18:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CF8277542; Mon, 24 Oct 2022 04:57:05 -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 ams.source.kernel.org (Postfix) with ESMTPS id 567A0B811A1; Mon, 24 Oct 2022 11:53:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4B50C433D6; Mon, 24 Oct 2022 11:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612405; bh=m6NQJ5EmDqzyBSscFVL9+7RWcSwAfWV9TMWJzvPm/kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiKIzA1zAInlGpBMMoB4C7wlWOL7Re7MhfZhge68XSw0yH5MPoZLt64PDKVzpzdgL IsNf8RTfinOds2pjawK8p0oW+ZTEy6QGukwW3wI01kPnFbv44Wf1TL+Z2polw2J+w6 Hhw7fpx08hEbVvdfMm9Yf+jr7q0jODgRGsG/DCKc= 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.14 168/210] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:25 +0200 Message-Id: <20221024113002.413948464@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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.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 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 3248cf04d0b3..42616aca0ce4 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -276,10 +276,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) upcall.portid = ovs_vport_find_upcall_portid(p, skb); 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