From patchwork Mon Mar 1 16:13:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 388652 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp3505447jap; Mon, 1 Mar 2021 08:45:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkUJ4SQiWvQWi0i65R3f3Chzt9U0hbfpX9Sp+/Wi5NfpiQSix+a7hb7upBO5k3zZPNOsgE X-Received: by 2002:a17:906:543:: with SMTP id k3mr14397368eja.139.1614617104594; Mon, 01 Mar 2021 08:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614617104; cv=none; d=google.com; s=arc-20160816; b=CrJmfNNqvkFQLUQEDDn3L5nYbvdaz6In0rCvx5b5+AhHedcldnQxZHKVDHDee6FAt3 LSKKSpdT0GaXh9pgnZdqU/kPxaeNSiCfWKaSb/brC/0vmmOHAWhJjq5bodLOBw+TImCd ia44C9qd7fug8elYkyJgDlfkMu/fKvIpR11xV47sAGt+8cJtQK2zMy1ZG43CKPmGyCDy 404qKEDStybK9nGEPxOy9hRN+gXb9H1DwXdVKway3v8wcEfgoFHVvFOLL4aCWhKF5r0i 4JA97jF9ro8mfySZ/T8wSWc+DdsbwTIkumuiEHLCphVxgTegpFaUWdEeZ8LIT8lh2O8T B98g== 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=6MNIZ2/0GQDMgoMeZBK3NCUNZG5emQWIPNVktfyGJ1c=; b=OQw6BDr5NjnRcoK3l2jk1FUXxJL7lAGhd/kxykZTRCCubt8wLhA4TwnBTDXC85zXwP CyP+x0779fxwV+7LhfmgeD89LnDQUAY0wMYwXCFmpj3HuHpGz+yYfI4vPNQwZbxEHmkV 6nNDNjob/WalO49cvvf5GtZl/ttmyptkKUO1tawVky8BVFgdyB4Kmx+LrWmLZRR4FdLB G5R0Gq2hXA5xu7rLhYtUrfK4tvS3B+cxuJx8FtUcv4TcX7YIR4giZTR3XizIbdIwJKhW oQq5TaLLDX7klrmtGhOWpZfgjDEKWiHqTmTt+KXO7Y464BdI512kHT74YtGucXzh3lN3 FSXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FohTeBNr; 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 f7si12055634edd.14.2021.03.01.08.45.04; Mon, 01 Mar 2021 08:45:04 -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=FohTeBNr; 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 S235279AbhCAQnn (ORCPT + 13 others); Mon, 1 Mar 2021 11:43:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:43464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232772AbhCAQhH (ORCPT ); Mon, 1 Mar 2021 11:37:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9AEE564EDB; Mon, 1 Mar 2021 16:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614615990; bh=O3wopb98D50g97aOLPzC+gXk45P2albeLGr1J/0w0CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FohTeBNrfNcOWe/jzJLoaP0o1SijKKicKWOLVpPfGbSGhUI8XZtNbaUSYK4egBBLf xaeqk6jPQUkBLz92YfpBZueY2qbZTSW/kIE+GBEo6r/x8imz+GXjd8CL2UKVilCF4U t5zeR3Oex05IzamBV3FSMv9dxDE26+IOhImPfHL4= 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.9 130/134] sunvnet: use icmp_ndo_send helper Date: Mon, 1 Mar 2021 17:13:51 +0100 Message-Id: <20210301161019.992508572@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161013.585393984@linuxfoundation.org> References: <20210301161013.585393984@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 | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) --- a/drivers/net/ethernet/sun/sunvnet_common.c +++ b/drivers/net/ethernet/sun/sunvnet_common.c @@ -1263,28 +1263,12 @@ int sunvnet_start_xmit_common(struct sk_ 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); - rcu_read_unlock(); - 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; }