From patchwork Mon Mar 1 16:14:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 388679 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3574781jap; Mon, 1 Mar 2021 10:11:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwN0ewYpLvob3cvZhh0E/tCtiGzITc9jaJ9/nn4tcb/8qfwNfc5Sp1az1YZJq1L0nXy/hoD X-Received: by 2002:a17:907:2bf6:: with SMTP id gv54mr17569559ejc.514.1614622297154; Mon, 01 Mar 2021 10:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614622297; cv=none; d=google.com; s=arc-20160816; b=B2IFvX/S5ld9d0eJz6D4Jhev8oRFO59R9drmZq3AoPcHQrJ7F7Jt7yt5seoPDXolzN miUcDs9qBPo7OksrYGFxciFeGPHFNrwcaJv0UB38qZmPcf2306MVwql6lAvCjYiPHrG6 aBZZ6yUnnlJHeT/ndZYStjXgLe9x8Lrrs3mcKNJHXINtZa1RgIvmPltHela2PQk1MTDT ApuwziqAvKuaL7W8D7JVh+H1nbF4HCH9gKX3wCPzbPG+Gf608m5caqrLfXxOhNlGhykm CQbUgrrrLkF5OwX5MVL+4P6zsGMpq0nzQ7S/ULDcXBY/id5OOaFtZWpvFcUUmc8HM8zT nkkQ== 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=ij5TAtBaIzy1XI5uaqUThAkaorSlgEWLGJ3NRXaehIk=; b=SPdoNh+p2fJRYnGTvmHV0/JvGDUNwsm4fTI51er6RxYISKe+0Ozx5dOC2/3dRiec+z FHtVnhygyN3gIPdRPLId6twfqRdTxgltRMftIxz20plrxAX0vKB3RkByq/wHUtPILCM1 kDqh27ki2wuEkVxAU8c6qLth/81xokEOfbBudi/z/IaxhDQvahGRQVHwDts6MT9mbaDI SMLz/jIkil7QuPhxxNsRXovfa+6KQVAECZ66QR9Zc2uwz+o4YY8/5EB7EFcsOwYaUmuN hAzIY3xZS9mkYDfs19yvQ2QJ+29Qu4gXe2WvE/gp6qaZcOSjBbJMnISApYkX7kIhi3E3 5HpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cxbmSInm; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si2621082edm.418.2021.03.01.10.11.36; Mon, 01 Mar 2021 10:11:37 -0800 (PST) Received-SPF: pass (google.com: domain of stable-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=@linuxfoundation.org header.s=korg header.b=cxbmSInm; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S238662AbhCASKN (ORCPT + 13 others); Mon, 1 Mar 2021 13:10:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:54156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234860AbhCASDg (ORCPT ); Mon, 1 Mar 2021 13:03:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ADB356511E; Mon, 1 Mar 2021 17:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618173; bh=452moKIc6TwuzRdS9Pe3ofv+4LHyBGggXPdSMhgEIeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxbmSInmsHsj3vXPtvhpoviSI0IOyRMAYo+gWB0u+JFWnH5rCt4iR585FPRqzo0yz gR3t/YTsCmRubHLrgYBt5rYwv8GlNYISSfJbWRUgRI4oZ4F2g7vP2FONXV/Lg8vLhi 1Vch0KjJPTXz2Q7pMsgNHcqd7E7cQUBmS/alOUCU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Shannon Nelson , "David S. Miller" Subject: [PATCH 5.4 333/340] sunvnet: use icmp_ndo_send helper Date: Mon, 1 Mar 2021 17:14:37 +0100 Message-Id: <20210301161104.682465910@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161048.294656001@linuxfoundation.org> References: <20210301161048.294656001@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jason A. Donenfeld commit 67c9a7e1e3ac491b5df018803639addc36f154ba upstream. 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/sun/sunvnet_common.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c @@ -1353,27 +1353,12 @@ sunvnet_start_xmit_common(struct sk_buff 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; }