From patchwork Mon Oct 24 11:31:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422117wru; Mon, 24 Oct 2022 05:21:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4foH5fICsmdtYLMtjvmuIXUBbx57fzj+tGpdihwnrI9RHfQuQI2ni2W7MZeaTawFh//l+m X-Received: by 2002:a05:6402:548f:b0:457:ed40:5f58 with SMTP id fg15-20020a056402548f00b00457ed405f58mr30361682edb.408.1666614115413; Mon, 24 Oct 2022 05:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614115; cv=none; d=google.com; s=arc-20160816; b=Hxx+IHCiecgyen8ZTP1Defv22PCG/emspdJ23svk/L/hqbTT3ov/pN+2L8MoJo0nmw WiczilMeUW1r+ZNWMqbS8Qg9w9AZNGCBwVTlPsikMTOQ+DhIDRbHURFmI3YTM47ueO0X DJOFqXMf8DlejL4ux83y8D3nQHwqy0hVhJ9udGoFh1D146Xuf9CWqHbA7qMmfF73o7b9 c+N/T418/9jSkr64ziJciXRJmmz7mBE2LYRx7LTy8GfGZh/+SNhrQfpZ6Wv5mGK+9Co8 LOLVHzSBU2mHAozBHVFXKB0S8lYZ4Hbe5bK+NnRIgtoQ5DSFZ9Ti3WSrZ1y55W/92sdB No5w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho30-20020a1709070e9e00b007a6ec6fb027si3743418ejc.538.2022.10.24.05.21.30; Mon, 24 Oct 2022 05:21:55 -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 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?1747571563013213852?= X-GMAIL-MSGID: =?utf-8?q?1747571563013213852?= 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; }