From patchwork Mon Mar 1 16:14:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 388667 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3541146jap; Mon, 1 Mar 2021 09:26:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzit1meT/zQAL3OdP2Gk+Svzwv78BSm9Lo+jRDGE5iEcMJ/6yfMA+8+/QjsNNXbVWvxB8j2 X-Received: by 2002:a17:906:9442:: with SMTP id z2mr10146680ejx.79.1614619528652; Mon, 01 Mar 2021 09:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614619528; cv=none; d=google.com; s=arc-20160816; b=jVXsZUDCIghoQIawnBLwtx/+08vbYCda0JxyUKbw6ibhOKH1xdeR8DTPHctD3ASGGs qsxMafWiG2YjvIN8ll0LZgXOHD6MEpH+CcPMDElisZXRplDb3BH3vWhHYXAnNxpcG7Za JnJaSFsLzE2ob9FM3XXi/3AtCzs80j8nK+nTN02mEgOgLk8oOo+zdc1bNfLrjccDPM1d AoASjjfxc5PTugKvAkEqQjJpOaL9yFk0P8xddoG/Z2TlNgD7MpByebX5QcFF6dsLX15i K10R5HCSFlF/sh7mgNq18CbT0ZXVn1hoKOpdHXd5dwcTI7TpDMB6qwt/I4icwdcZKo1n Ik9w== 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=f/aay+MtvAUGtVaewy0BAIfDwu6PxpvoXCODhopwplVYXyWS+wV6nZWryvrzxMk2MR sjpqA9omPJF90LUrUvYb33rxSpCg4i2izm8V2IfbssVpzOgGPU4FmHOWbgruUyqdgBVn x8cftTW3J6ix/DsdDFlF9v8gKymm+BAISdBg0LEPlcFcf2wJYVEHuLKh+jk+91ZXcSjJ qIMYDLGPR31sCMrNk7VQJtyok2z8b9teKQx8c29wyWmyrevv+JbgW227KFHF9j7Y20PT d/Cz/+y4Uck8KsEHPcLQ+qOxH9Wf7Y03hnas+j6yA/AZMT1qEHkyd9xpTWovv0t13Y/S TxTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BjtzmEMo; 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 s28si3670250edw.110.2021.03.01.09.25.28; Mon, 01 Mar 2021 09:25:28 -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=BjtzmEMo; 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 S238267AbhCARYD (ORCPT + 13 others); Mon, 1 Mar 2021 12:24:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:36910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233651AbhCARSg (ORCPT ); Mon, 1 Mar 2021 12:18:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D2CA564ECE; Mon, 1 Mar 2021 16:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617211; bh=452moKIc6TwuzRdS9Pe3ofv+4LHyBGggXPdSMhgEIeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BjtzmEMoJAKzqxihE8fszac49s00DkHwRVApSZWRmcez+U8FJQYBCrl0ADUafhJai cVtiOI38uIUXnNiJ1/L8UEiS8HFOnZb7z6Wpfls82xFO0PRyZF6fvpE3dEbsN2ydU6 4J3/YsuhQI/u0ANlXcXrPMJVFoU+I3LBUfLfAt1I= 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 4.19 241/247] sunvnet: use icmp_ndo_send helper Date: Mon, 1 Mar 2021 17:14:21 +0100 Message-Id: <20210301161043.504566677@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@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; }