From patchwork Tue Feb 11 15:00:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236316 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=PIA+qVse; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Yr0vpYz9sRQ for ; Wed, 12 Feb 2020 02:00:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729944AbgBKPAr (ORCPT ); Tue, 11 Feb 2020 10:00:47 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPAq (ORCPT ); Tue, 11 Feb 2020 10:00:46 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id dbafbced; Tue, 11 Feb 2020 14:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=3uXxfPkhVfNwm/pqA20yRBoDW 6A=; b=PIA+qVseu7WnVo3wGwPiEI3+Xp5nEQh/8IaY9j5ttNQDnsVDF8orHhakI UiegCp459UqODsUUP3xqjd/FB6vqJPE6rPcqm+qwqFlMD21irKVrax5CLtLl/Mj4 VNPJ7v4s20fVYqPJukwY2Am+TFdPlSszmkJts5S9MGonceMRb3FzPaiH/2YcwNy0 2MMnmgQzw6Go0agzaQqvlJVMakZ0MjWncaEpQNJbWTJgHhwCbAX2xRyuV1S+cWK4 +wWnhCgKgHGjEVQehEAzy+lafIi52RD7GQ4hhkbO+CmqFRp2cG4+2ZzLeARjlxvI C+NEoDcgf+ZrJrk+/CZOZNSVALvoA== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 410533aa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:01 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Florian Westphal Subject: [PATCH v3 net 1/9] icmp: introduce helper for nat'd source address in network device context Date: Tue, 11 Feb 2020 16:00:20 +0100 Message-Id: <20200211150028.688073-2-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This introduces a helper function to be called only by network drivers that wraps calls to icmp[v6]_send in a conntrack transformation, in case NAT has been used. The transformation happens only from a non-shared skb context, and the skb is fixed back up to its original state after, in case the calling code continues to use it. We don't want to pollute the non-driver path, though, so we introduce this as a helper to be called by places that actually make use of this, as suggested by Florian. Signed-off-by: Jason A. Donenfeld Cc: Florian Westphal --- include/linux/icmpv6.h | 6 ++++++ include/net/icmp.h | 6 ++++++ net/ipv4/icmp.c | 28 ++++++++++++++++++++++++++++ net/ipv6/ip6_icmp.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index ef1cbb5f454f..93338fd54af8 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -31,6 +31,12 @@ static inline void icmpv6_send(struct sk_buff *skb, } #endif +#if IS_ENABLED(CONFIG_NF_NAT) +void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info); +#else +#define icmpv6_ndo_send icmpv6_send +#endif + extern int icmpv6_init(void); extern int icmpv6_err_convert(u8 type, u8 code, int *err); diff --git a/include/net/icmp.h b/include/net/icmp.h index 5d4bfdba9adf..9ac2d2672a93 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -43,6 +43,12 @@ static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt); } +#if IS_ENABLED(CONFIG_NF_NAT) +void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info); +#else +#define icmp_ndo_send icmp_send +#endif + int icmp_rcv(struct sk_buff *skb); int icmp_err(struct sk_buff *skb, u32 info); int icmp_init(void); diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 18068ed42f25..0cd23df4ad5c 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -748,6 +748,34 @@ out:; } EXPORT_SYMBOL(__icmp_send); +#if IS_ENABLED(CONFIG_NF_NAT) +#include +void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info) +{ + enum ip_conntrack_info ctinfo; + struct nf_conn *ct; + __be32 orig_ip; + + ct = nf_ct_get(skb_in, &ctinfo); + if (!ct || !(ct->status & IPS_SRC_NAT)) { + icmp_send(skb_in, type, code, info); + return; + } + + if (unlikely(WARN_ON(skb_shared(skb_in)) || + skb_network_header(skb_in) < skb_in->head || + (skb_network_header(skb_in) + sizeof(struct iphdr)) > + skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in, + skb_network_offset(skb_in) + sizeof(struct iphdr)))) + return; + + orig_ip = ip_hdr(skb_in)->saddr; + ip_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.ip; + icmp_send(skb_in, type, code, info); + ip_hdr(skb_in)->saddr = orig_ip; +} +EXPORT_SYMBOL(icmp_ndo_send); +#endif static void icmp_socket_deliver(struct sk_buff *skb, u32 info) { diff --git a/net/ipv6/ip6_icmp.c b/net/ipv6/ip6_icmp.c index 02045494c24c..00e94e1dffae 100644 --- a/net/ipv6/ip6_icmp.c +++ b/net/ipv6/ip6_icmp.c @@ -45,4 +45,33 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) rcu_read_unlock(); } EXPORT_SYMBOL(icmpv6_send); + +#if IS_ENABLED(CONFIG_NF_NAT) +#include +void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info) +{ + enum ip_conntrack_info ctinfo; + struct in6_addr orig_ip; + struct nf_conn *ct; + + ct = nf_ct_get(skb_in, &ctinfo); + if (!ct || !(ct->status & IPS_SRC_NAT)) { + icmpv6_send(skb_in, type, code, info); + return; + } + + if (unlikely(WARN_ON(skb_shared(skb_in)) || + skb_network_header(skb_in) < skb_in->head || + (skb_network_header(skb_in) + sizeof(struct ipv6hdr)) > + skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in, + skb_network_offset(skb_in) + sizeof(struct ipv6hdr)))) + return; + + orig_ip = ipv6_hdr(skb_in)->saddr; + ipv6_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.in6; + icmpv6_send(skb_in, type, code, info); + ipv6_hdr(skb_in)->saddr = orig_ip; +} +EXPORT_SYMBOL(icmpv6_ndo_send); +#endif #endif From patchwork Tue Feb 11 15:00:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236318 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=dovs/oz2; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Yt1xD2z9sP7 for ; Wed, 12 Feb 2020 02:00:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730026AbgBKPAt (ORCPT ); Tue, 11 Feb 2020 10:00:49 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPAt (ORCPT ); Tue, 11 Feb 2020 10:00:49 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id dd66e016; Tue, 11 Feb 2020 14:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=JzV6toZzstw9vzB/ziu+YJh5G mY=; b=dovs/oz2vUL3klrd1VlAbhcgO9Iz0Zo6IoF576bOZEQtWLc8IfPDhH2vk zlllqR2eK//rIsfPHYSdxi8oTRKXfnlerEh1GFT5ILy7fgJbMj6uuA2f4vWEsUP0 5Xmc8ERs3FmVGVjANcjmOAEyjy5K8p5znhjbOHLJLhHUcO2lfY58FfJw5xYeiV3b eHazUCL3Na/pA+wQ+P4c6Gsok4Gm1S10jXMqMMH9fvyXG21/da13JovqFsDXPVsr LnsmpRkxevkzhcP/nYx9DESj4iyBYJVNVmq39iUWikY15DL+iyLfRueEH9XISDXu jRY4jewcpObkNkZwaciEZLlZtTBPg== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 51f42231 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:03 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Harald Welte Subject: [PATCH v3 net 2/9] gtp: use icmp_ndo_send helper Date: Tue, 11 Feb 2020 16:00:21 +0100 Message-Id: <20200211150028.688073-3-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Because gtp is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly. Signed-off-by: Jason A. Donenfeld Cc: Harald Welte --- drivers/net/gtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index af07ea760b35..672cd2caf2fb 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -546,8 +546,8 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev, mtu < ntohs(iph->tot_len)) { netdev_dbg(dev, "packet too big, fragmentation needed\n"); memset(IPCB(skb), 0, sizeof(*IPCB(skb))); - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, - htonl(mtu)); + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(mtu)); goto err_rt; } From patchwork Tue Feb 11 15:00:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236319 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=GDYTWylV; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Yw25TLz9sP7 for ; Wed, 12 Feb 2020 02:00:52 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730060AbgBKPAv (ORCPT ); Tue, 11 Feb 2020 10:00:51 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPAu (ORCPT ); Tue, 11 Feb 2020 10:00:50 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id f6124429; Tue, 11 Feb 2020 14:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=6IxQnhqna6P4699fOE6/+Cvkl kY=; b=GDYTWylV6KRyzT0ZjNSjhogBozoLVouEsTHtN+/UtZu73FLd23ckJXNJq /E3AeD8KmLycDrr3rFca+Qf7YaAdA63UOaZpVax26JtbHIf67HW1tnG6d32/fPW8 HA8OgAtYwmlizWZgxq5ufc8yz295/sU2sOoXq0IHGNC8mfJRx5wJV4sjN5bwbF3Q H8VNBbf7KZRSA72yhQRfMi+CdPRSg6z5cCT81ZdVgLgx/gESFN0569ikTG6LxExl YmyT8HrxsDgdQjRGnUBMiGECFm8k84y1fQUcyy9H2hdkkDUteMnn7rUBaKrbJ0F8 j+JBU0tFS9VIRgxf2t607lm94mK1g== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 96d6627d (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:05 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Shannon Nelson Subject: [PATCH v3 net 3/9] sunvnet: use icmp_ndo_send helper Date: Tue, 11 Feb 2020 16:00:22 +0100 Message-Id: <20200211150028.688073-4-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Because sunvnet is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly. While we're at it, doing the additional route lookup before calling icmp_ndo_send is superfluous, since this is the job of the icmp code in the first place. Signed-off-by: Jason A. Donenfeld Cc: Shannon Nelson --- drivers/net/ethernet/sun/sunvnet_common.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c index c23ce838ff63..8dc6c9ff22e1 100644 --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c @@ -1350,27 +1350,12 @@ sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev, if (vio_version_after_eq(&port->vio, 1, 3)) localmtu -= VLAN_HLEN; - if (skb->protocol == htons(ETH_P_IP)) { - struct flowi4 fl4; - struct rtable *rt = NULL; - - memset(&fl4, 0, sizeof(fl4)); - fl4.flowi4_oif = dev->ifindex; - fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos); - fl4.daddr = ip_hdr(skb)->daddr; - fl4.saddr = ip_hdr(skb)->saddr; - - rt = ip_route_output_key(dev_net(dev), &fl4); - if (!IS_ERR(rt)) { - skb_dst_set(skb, &rt->dst); - icmp_send(skb, ICMP_DEST_UNREACH, - ICMP_FRAG_NEEDED, - htonl(localmtu)); - } - } + if (skb->protocol == htons(ETH_P_IP)) + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(localmtu)); #if IS_ENABLED(CONFIG_IPV6) else if (skb->protocol == htons(ETH_P_IPV6)) - icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu); + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu); #endif goto out_dropped; } From patchwork Tue Feb 11 15:00:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236320 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=fCUdLynf; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Yz1zPqz9sP7 for ; Wed, 12 Feb 2020 02:00:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730094AbgBKPAy (ORCPT ); Tue, 11 Feb 2020 10:00:54 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPAy (ORCPT ); Tue, 11 Feb 2020 10:00:54 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 5edf984c; Tue, 11 Feb 2020 14:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=wfT3X7qXqNUU0/0EQjnwE4gcH QY=; b=fCUdLynf2EV7XruG9UThWmBHCTyTvFsjgfJRrmhlXvunPF/E/N+yZ9wzz Q1hNi/hxUz+4ZbmlbXE8ZE8SQOHZXnkz3vf9LpXWBfdwq9/8Jy+pAeHSfmgrJK9p 4VNdau9ml1Tm51h5gzlhOFxhVs5V4ef0Ywk9CHSs9FDoB1tmlEVm57Vc0yIC1KX1 6zFsH27RHlJklzKpW7RQ5ad4fDMV9H1s4OH+MYTrjvZ9+l1PGGzf91ydQgzq4zTn su7sTpGwjdMaifB8yXOmtHGNlxRjviJIsKKFBtqdwdTrZlqQ/tOrzba3+RYnWG1R UuMTKaS/WayJ56r7UGyPqpgKnEI/g== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 7a047f67 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:07 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Nicolas Dichtel , Steffen Klassert Subject: [PATCH v3 net 4/9] xfrm: interface: use icmp_ndo_send helper Date: Tue, 11 Feb 2020 16:00:23 +0100 Message-Id: <20200211150028.688073-5-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Because xfrmi is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly. Signed-off-by: Jason A. Donenfeld Cc: Nicolas Dichtel Cc: Steffen Klassert --- net/xfrm/xfrm_interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c index dc651a628dcf..3361e3ac5714 100644 --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -300,10 +300,10 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) if (mtu < IPV6_MIN_MTU) mtu = IPV6_MIN_MTU; - icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); } else { - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, - htonl(mtu)); + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, + htonl(mtu)); } dst_release(dst); From patchwork Tue Feb 11 15:00:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236321 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=JpoqBIPl; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Z12tKbz9sP7 for ; Wed, 12 Feb 2020 02:00:57 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730146AbgBKPA4 (ORCPT ); Tue, 11 Feb 2020 10:00:56 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPA4 (ORCPT ); Tue, 11 Feb 2020 10:00:56 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 063461ac; Tue, 11 Feb 2020 14:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=P9Jcfk0RuYp4b4xyImJ9B/Wl8 SA=; b=JpoqBIPl89T39vBfmvNKtq2Wi6hh7GTdAU5sumt+GLcFsccAsJl/gwKvs iokm69Su3A1kJI94sn767R2EzmWvtwqTvTZyRBwmcSZomMOOS52HCXDzYuMcY/sN mKRutzSeZ+zfSm05NibvEYS0TbNQE7myfULd8DGJRdHGojmJ2ywJsb0SzE9mBpxO GidQ6Zw/BGcP0LvOaS/0KCRU/Hn7bDK25CFqxojVrywdHgNvtt0XA9GVEqZqDfFi LTwlh59kMMjA9RRsm7pthWueMgKp50WZ7b2ZTmTLUJk9yMZz3hP2w7dUEcpfIAj3 TKvEvJ2roVIeA8nToJ4LUtMZVTZng== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 953adfde (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:09 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" Subject: [PATCH v3 net 5/9] wireguard: device: use icmp_ndo_send helper and remove skb_share_check Date: Tue, 11 Feb 2020 16:00:24 +0100 Message-Id: <20200211150028.688073-6-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Because wireguard is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly. Also, skb_share_check in the xmit path is an impossible condition to reach; an skb in ndo_start_xmit won't be shared by definition. This commit adds a small test to the wireguard test suite to ensure that the new functions continue doing the right thing in the context of wireguard. It does this by setting up a condition that will definately evoke an icmp error message from the driver, but along a nat'd path. Signed-off-by: Jason A. Donenfeld Link: https://lore.kernel.org/netdev/CAHmME9pk8HEFRq_mBeatNbwXTx7UEfiQ_HG_+Lyz7E+80GmbSA@mail.gmail.com/ --- drivers/net/wireguard/device.c | 8 ++------ tools/testing/selftests/wireguard/netns.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireguard/device.c b/drivers/net/wireguard/device.c index 16b19824b9ad..62cb7b106c52 100644 --- a/drivers/net/wireguard/device.c +++ b/drivers/net/wireguard/device.c @@ -167,10 +167,6 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) skb_list_walk_safe(skb, skb, next) { skb_mark_not_on_list(skb); - skb = skb_share_check(skb, GFP_ATOMIC); - if (unlikely(!skb)) - continue; - /* We only need to keep the original dst around for icmp, * so at this point we're in a position to drop it. */ @@ -203,9 +199,9 @@ static netdev_tx_t wg_xmit(struct sk_buff *skb, struct net_device *dev) err: ++dev->stats.tx_errors; if (skb->protocol == htons(ETH_P_IP)) - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); else if (skb->protocol == htons(ETH_P_IPV6)) - icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0); + icmpv6_ndo_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0); kfree_skb(skb); return ret; } diff --git a/tools/testing/selftests/wireguard/netns.sh b/tools/testing/selftests/wireguard/netns.sh index f5ab1cda8bb5..4e31d5b1bf7f 100755 --- a/tools/testing/selftests/wireguard/netns.sh +++ b/tools/testing/selftests/wireguard/netns.sh @@ -297,7 +297,17 @@ ip1 -4 rule add table main suppress_prefixlength 0 n1 ping -W 1 -c 100 -f 192.168.99.7 n1 ping -W 1 -c 100 -f abab::1111 +# Have ns2 NAT into wg0 packets from ns0, but return an icmp error along the right route. +n2 iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -d 192.168.241.0/24 -j SNAT --to 192.168.241.2 +n0 iptables -t filter -A INPUT \! -s 10.0.0.0/24 -i vethrs -j DROP # Manual rpfilter just to be explicit. +n2 bash -c 'printf 1 > /proc/sys/net/ipv4/ip_forward' +ip0 -4 route add 192.168.241.1 via 10.0.0.100 +n2 wg set wg0 peer "$pub1" remove +[[ $(! n0 ping -W 1 -c 1 192.168.241.1 || false) == *"From 10.0.0.100 icmp_seq=1 Destination Host Unreachable"* ]] + n0 iptables -t nat -F +n0 iptables -t filter -F +n2 iptables -t nat -F ip0 link del vethrc ip0 link del vethrs ip1 link del wg0 From patchwork Tue Feb 11 15:00:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236322 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=MPCsTS4X; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Z33qJxz9sP7 for ; Wed, 12 Feb 2020 02:00:59 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730198AbgBKPA6 (ORCPT ); Tue, 11 Feb 2020 10:00:58 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPA5 (ORCPT ); Tue, 11 Feb 2020 10:00:57 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 02059ba5; Tue, 11 Feb 2020 14:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=JX7voRrNvyqx3y1FhLyis66BK rs=; b=MPCsTS4X1bsARpZ5aAgvm+Mzg42u475ahGnQRilaqPOS4Y/CnEDm1E/5p uAcW/MRFjzLpRVjOz/BPRb5/bG/iWtk+qOjPweUZDD+EVDEZqfbqRq2+3mkCF5YR sAlkgVGCl1KO2q3JixqB36XhYsngA2eE9sD2s21uW6FW6YxjL8da3MT1HNTk1sgt xzBTjt3ikD4gcg+CELw4LFwkIBm81aslopcbjWwbTk5i8FBnlIMttzJdhqM0sTTM 69xx/7O+VwxIUA97GcyyjQdGFHndboUt21u0cWFS5NWxeFZ/OIQO4r/NBYlhzVwq q0ooQhWu2fSfD1fFGUFVQrqEXvbUg== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 3925063b (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:11 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , stefanr@s5r6.in-berlin.de Subject: [PATCH v3 net 6/9] firewire: remove skb_share_check from xmit path Date: Tue, 11 Feb 2020 16:00:25 +0100 Message-Id: <20200211150028.688073-7-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is an impossible condition to reach; an skb in ndo_start_xmit won't be shared by definition. Signed-off-by: Jason A. Donenfeld Cc: stefanr@s5r6.in-berlin.de Link: https://lore.kernel.org/netdev/CAHmME9pk8HEFRq_mBeatNbwXTx7UEfiQ_HG_+Lyz7E+80GmbSA@mail.gmail.com/ --- drivers/firewire/net.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 715e491dfbc3..c48eae922566 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -1259,10 +1259,6 @@ static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net) if (ptask == NULL) goto fail; - skb = skb_share_check(skb, GFP_ATOMIC); - if (!skb) - goto fail; - /* * Make a copy of the driver-specific header. * We might need to rebuild the header on tx failure. From patchwork Tue Feb 11 15:00:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236323 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=cONoA0iz; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Z56Qv1z9sP7 for ; Wed, 12 Feb 2020 02:01:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730238AbgBKPBB (ORCPT ); Tue, 11 Feb 2020 10:01:01 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPBA (ORCPT ); Tue, 11 Feb 2020 10:01:00 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 6577c25f; Tue, 11 Feb 2020 14:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=11b3qdMpEUn3A+QDH0DblVlTP iM=; b=cONoA0izQ5VAJYgFqSp9C1NAZYImk+htrDRv8h4STTPNqGmdwmk+tkSpH xPwqSmQBJ7BYttHpw0OPav4z3Vyqi4Vx+J6J6X8ulRfgEsiDsW2VjLj0owTPhIqA 6oYU92C2amOoCO8X6vW7p80laayFZDH/6y7pxR7d3u0cynQYQzU+8gsQijXohNwb /HcHVJcCToRJaybY5gf47bCePy96muMldMbkPhRF0tH5cSdZFPaDh0rVCymxkUQ3 EZXC4ankiMRsXmjOM09+ZReYM7LcEtMMORU9m9MOU1mGPCZ//AdNLJkXMM+7LnMM oZzXT2ienMkA/EV7V2cWE+yykQAkg== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id e0e14332 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:13 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Mahesh Bandewar Subject: [PATCH v3 net 7/9] ipvlan: remove skb_share_check from xmit path Date: Tue, 11 Feb 2020 16:00:26 +0100 Message-Id: <20200211150028.688073-8-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is an impossible condition to reach; an skb in ndo_start_xmit won't be shared by definition. Signed-off-by: Jason A. Donenfeld Cc: Mahesh Bandewar Link: https://lore.kernel.org/netdev/CAHmME9pk8HEFRq_mBeatNbwXTx7UEfiQ_HG_+Lyz7E+80GmbSA@mail.gmail.com/ --- drivers/net/ipvlan/ipvlan_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index 30cd0c4f0be0..da40723065f2 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -605,9 +605,6 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev) return ipvlan_rcv_frame(addr, &skb, true); } } - skb = skb_share_check(skb, GFP_ATOMIC); - if (!skb) - return NET_XMIT_DROP; /* Packet definitely does not belong to any of the * virtual devices, but the dest is local. So forward From patchwork Tue Feb 11 15:00:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236324 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=DCRA4EKf; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Z74TvRz9sP7 for ; Wed, 12 Feb 2020 02:01:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730258AbgBKPBC (ORCPT ); Tue, 11 Feb 2020 10:01:02 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPBC (ORCPT ); Tue, 11 Feb 2020 10:01:02 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id d8214ce4; Tue, 11 Feb 2020 14:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=ShufVLUsTcLwh/Zol/iMuQa/w RI=; b=DCRA4EKfbNe7DCa8OMo8rblwvizcUlR0wHVnUMYp8HKPGQ5dC029N1ucL +TttHpARLKROH80DIANivltvHQ/vVXyqlt9bZiLjd6EabDSVXHvEnMT7dK77Yp+A 544pWhKTwH0Q7dR/cxyykFAMsx/ri3dbgbowWzQD+0+9FioI0uCT5uiZfq7yZnXW +YZPO2nVzI+7IDQkxlGHEKuYUGtSmlSvwD7EKc+4K5F7ufdc1Jbj83pNrt72dIFv ZhT97bPpNzvR2OQm2p8v0mdWH5cUIxpaMb+k008dFBnrdaOhI1+BlEioJdHPKGjr d6fc4vkUYwd5kWHHuTxSnt92o8DRA== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 00f3ff0b (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:15 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Jeff Kirsher Subject: [PATCH v3 net 8/9] fm10k: remove skb_share_check from xmit path Date: Tue, 11 Feb 2020 16:00:27 +0100 Message-Id: <20200211150028.688073-9-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is an impossible condition to reach; an skb in ndo_start_xmit won't be shared by definition. Signed-off-by: Jason A. Donenfeld Cc: Jeff Kirsher Link: https://lore.kernel.org/netdev/CAHmME9pk8HEFRq_mBeatNbwXTx7UEfiQ_HG_+Lyz7E+80GmbSA@mail.gmail.com/ --- drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c index 0637ccadee79..b6cd7ab6efbe 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c @@ -641,11 +641,6 @@ static netdev_tx_t fm10k_xmit_frame(struct sk_buff *skb, struct net_device *dev) struct vlan_hdr *vhdr; __be16 proto; - /* make sure skb is not shared */ - skb = skb_share_check(skb, GFP_ATOMIC); - if (!skb) - return NETDEV_TX_OK; - /* make sure there is enough room to move the ethernet header */ if (unlikely(!pskb_may_pull(skb, VLAN_ETH_HLEN))) return NETDEV_TX_OK; From patchwork Tue Feb 11 15:00:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 1236325 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=zx2c4.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha1 header.s=mail header.b=v8KFWqsG; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48H5Z95qRDz9sP7 for ; Wed, 12 Feb 2020 02:01:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730285AbgBKPBE (ORCPT ); Tue, 11 Feb 2020 10:01:04 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:34135 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbgBKPBE (ORCPT ); Tue, 11 Feb 2020 10:01:04 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id fd2ff95a; Tue, 11 Feb 2020 14:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=NgYNluWNYqWNVHMj35wM6xWxZ C8=; b=v8KFWqsG11SdrabGPR4/nCpLE+sunMJ+WWqTY7MuLRQARDkGNdaBVpP89 2aABUldklrgfWICX1HZwygd2/bp/eFoWy8XC33Zcat3WwyEJbOl77g2e9ODjUHQn P/S3w4DB5N7ldLFDeKCgljfKMJ0TCyfZHXsrzdwTkFoX0G/7QWZjhfBSavFXXBUU NLs1xMTUfnuBdxAlP/0k+zhtMG00FgRJvkLhBrKZeRAJ4OVXp7zBXT19FvWKAqSK sQrVPyKUvN3TVnZlO+HseKULGosU15VMkjpbD5TNRSi3jVyROb466NoYiHh/zbMH yOIzOEE7+FquKnBu7wIIT5JUmC81w== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a45e62b6 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Tue, 11 Feb 2020 14:59:18 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net Cc: "Jason A. Donenfeld" , Sathya Perla , Ajit Khaparde , Sriharsha Basavapatna , Somnath Kotur Subject: [PATCH v3 net 9/9] benet: remove skb_share_check from xmit path Date: Tue, 11 Feb 2020 16:00:28 +0100 Message-Id: <20200211150028.688073-10-Jason@zx2c4.com> In-Reply-To: <20200211150028.688073-1-Jason@zx2c4.com> References: <20200210141423.173790-2-Jason@zx2c4.com> <20200211150028.688073-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This is an impossible condition to reach; an skb in ndo_start_xmit won't be shared by definition. Signed-off-by: Jason A. Donenfeld Cc: Sathya Perla Cc: Ajit Khaparde Cc: Sriharsha Basavapatna Cc: Somnath Kotur Link: https://lore.kernel.org/netdev/CAHmME9pk8HEFRq_mBeatNbwXTx7UEfiQ_HG_+Lyz7E+80GmbSA@mail.gmail.com/ --- drivers/net/ethernet/emulex/benet/be_main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 56f59db6ebf2..8b797adb3065 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -1048,10 +1048,6 @@ static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, bool insert_vlan = false; u16 vlan_tag = 0; - skb = skb_share_check(skb, GFP_ATOMIC); - if (unlikely(!skb)) - return skb; - if (skb_vlan_tag_present(skb)) { vlan_tag = be_get_tx_vlan_tag(adapter, skb); insert_vlan = true;