Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3520794pxb; Mon, 24 Jan 2022 11:17:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyg1g/sfX91LGUtTUPpYejHLTzWM0DnH8vECyrte6ciO11TpXQxCLFMInEkZJ3kRrNC63Kb X-Received: by 2002:a63:6c04:: with SMTP id h4mr12685989pgc.30.1643051856213; Mon, 24 Jan 2022 11:17:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643051856; cv=none; d=google.com; s=arc-20160816; b=Hd8ebJExMoB3QDKlWn2aOgQVOG+8+YFL4U+hdtAFLtpk6GywRMrnJ/1LXed2nkoVrm yCWi7HD2z2TsOZPvHmrFJYq2TAd4b3RLKrJVBfvT9GF9Lnwx6LUOEvi/+WrQPZY9mZmF TByQHtZ1AtshsX7BEUH+vPwPWMfMSq71ulqdVYEj3o3/UgQEAkoEoys2XdSumNhc1Ndf MuTCvUj9H4InkYctTRemkriR+O/fAWAAick5x18pF7pmikHolDWGKXRcTEScHc9PsKCw OiVRVYZVldeuLo+Qknbh5On86wGxh7e5F0MtX68aZVjLHJnHD6nkoKyFj+1O7+XiWYYQ 7BhQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sBcUzmR8HipAMmfGTXgE1nbM6mUi+zj9tY3YPqei71A=; b=Xyf9L2ROAPs+llUo6738lSRVxM7A2Y8HvPJJ4L1G12M/Ad4ph/JtB+/ulYyPN4kbV1 rT3cpOp648+h4OFBFSj4gnHFGGVFjH7a14kppdBv/M0YU5I2xCv0gYrDzmvsjBJDsBxk hpY1IVpb9a0gEeDr+460hrLngMkl1oi9v0Hvv9aSJFo3yTOKyRsto8OUln6mX3sRGVqC wFfvbV+IeRj4x1MRp6Dz1g0P96Y5hVGagLRPVgH+CZqXbiDkmzW3QDNvT9TrtklzI+zy qXJ3OYX6iDPwmmbdhZsyDKuGUu7vj5Mcwv4npOuwsiqLo87Nblz6nBUQiMD+bYIsh3Fu U/xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VfujqfnN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si12503152pls.7.2022.01.24.11.17.13; Mon, 24 Jan 2022 11:17:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VfujqfnN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243043AbiAXNP5 (ORCPT + 99 others); Mon, 24 Jan 2022 08:15:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243041AbiAXNPy (ORCPT ); Mon, 24 Jan 2022 08:15:54 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78168C06173D; Mon, 24 Jan 2022 05:15:54 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id z131so4335025pgz.12; Mon, 24 Jan 2022 05:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sBcUzmR8HipAMmfGTXgE1nbM6mUi+zj9tY3YPqei71A=; b=VfujqfnNX0UUJbMS5C3SxFb/ynubohdqoD8vcFVVfMHKgzxhwGiyqmX8YOVXyuwMa9 gg00dtfqAiGjAHEL23X1ZX3AmyJnPqYlABkdcXRN+PcAt+a+wjdjS2lY1atSopw+4NEF U+zDmcsoHIwGcCoyuLAH2Cg0ZaDeEhI+1gkcQ7URBWviL6CZvzIlEQp8q0iP/2jBpyFb 8PbCctrJ7fqy9xukJ4yoVWMxz+eC+AYW+XbaLVJWPj3Yv6e8q1B3gidhtpvfKkVyQjre 9+u2f+7rWlvNAZRggAkmjerBHHXiGsVJr5UqG/DjFBpyW5LKWfqRbWn3bVHeZ/jBEuQi EBCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sBcUzmR8HipAMmfGTXgE1nbM6mUi+zj9tY3YPqei71A=; b=0cSMVsJ7EDgI25IN5qjhTq5144LETYoRN+YjiA1Z2RG7170/nrTOWtCtXUrk+h37ac DjN7qS59JYdxzPEPAM9vyXA/MswBiTP1MYGUSoKgFZwnHxsgE27infE8gu1qgzI/+P8g bOI4DP+qGjXwv4b7gFsMGzD3GZMw6L9YQtlop+A4Oa06Vz87EsXOtdTWJq98qCIYcQFK s++rbo8eAiU2Px5PaZg1PwQUlFkc1Etsl/ezHEx853Mxhk/3x6j3qT2EYwLMIi6PYgGx gXVkco2T/MkDBImxU66w/JdIonXMfpQMxSLSKOtIpDzbVU1yD6iluaLuoRrU6GHZCyyM kfrg== X-Gm-Message-State: AOAM532rM3LSYAou9Z2hSOl7wUe4e46kAeTb9iRXwKNJdKTj81n12rhE aptX0B1VKICudkNQtT4NwVE= X-Received: by 2002:a05:6a00:18a6:b0:4ca:38e0:400d with SMTP id x38-20020a056a0018a600b004ca38e0400dmr1147619pfh.22.1643030154055; Mon, 24 Jan 2022 05:15:54 -0800 (PST) Received: from localhost.localdomain ([43.132.141.9]) by smtp.gmail.com with ESMTPSA id j11sm16508806pfu.55.2022.01.24.05.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 05:15:53 -0800 (PST) From: menglong8.dong@gmail.com X-Google-Original-From: imagedong@tencent.com To: kuba@kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de, imagedong@tencent.com, edumazet@google.com, alobakin@pm.me, paulb@nvidia.com, pabeni@redhat.com, talalahmad@google.com, haokexin@gmail.com, keescook@chromium.org, memxor@gmail.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, cong.wang@bytedance.com Subject: [PATCH net-next 1/6] net: netfilter: use kfree_drop_reason() for NF_DROP Date: Mon, 24 Jan 2022 21:15:33 +0800 Message-Id: <20220124131538.1453657-2-imagedong@tencent.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220124131538.1453657-1-imagedong@tencent.com> References: <20220124131538.1453657-1-imagedong@tencent.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Menglong Dong Replace kfree_skb() with kfree_skb_reason() in nf_hook_slow() when skb is dropped by reason of NF_DROP. Signed-off-by: Menglong Dong --- include/linux/skbuff.h | 1 + include/trace/events/skb.h | 1 + net/netfilter/core.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bf11e1fbd69b..1bcd690b8ae1 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -320,6 +320,7 @@ enum skb_drop_reason { SKB_DROP_REASON_TCP_CSUM, SKB_DROP_REASON_TCP_FILTER, SKB_DROP_REASON_UDP_CSUM, + SKB_DROP_REASON_NETFILTER_DROP, SKB_DROP_REASON_MAX, }; diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 3e042ca2cedb..beed7bb2bc0e 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h @@ -16,6 +16,7 @@ EM(SKB_DROP_REASON_TCP_CSUM, TCP_CSUM) \ EM(SKB_DROP_REASON_TCP_FILTER, TCP_FILTER) \ EM(SKB_DROP_REASON_UDP_CSUM, UDP_CSUM) \ + EM(SKB_DROP_REASON_NETFILTER_DROP, NETFILTER_DROP) \ EMe(SKB_DROP_REASON_MAX, MAX) #undef EM diff --git a/net/netfilter/core.c b/net/netfilter/core.c index 354cb472f386..d1c9dfbb11fa 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -621,7 +621,8 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state, case NF_ACCEPT: break; case NF_DROP: - kfree_skb(skb); + kfree_skb_reason(skb, + SKB_DROP_REASON_NETFILTER_DROP); ret = NF_DROP_GETERR(verdict); if (ret == 0) ret = -EPERM; -- 2.34.1