Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp577389img; Fri, 22 Mar 2019 04:24:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqywuaHrnOf16uRf0IawpMJuYjaZyQ00DyADWB2TZen54SxXivac/b+jMIOznuGpvD1Vo9ga X-Received: by 2002:aa7:8d17:: with SMTP id j23mr8560348pfe.62.1553253871118; Fri, 22 Mar 2019 04:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253871; cv=none; d=google.com; s=arc-20160816; b=tEF8K6oz3SUJgWMZBKgdom1d2Zbxoa/DiXIyO/1eDdHdAPg8xB8+ega/EqhYnAwMWX 5y0dzdSfFa68WnzWeyQ2EhjLMDO+gn6d9/aJ+e1wRPpd9Loz2wb3BwEYnyghO4THmgO6 f1NL7SpjHEjgWskajijRlYgUpaYgSxzR1wOx01wuK4UKBlkUTjp/fFO1gFF7Cpev+28s 8ZRVaBkAqY0zhlXCIzrE9RyM+LVlkvOTT7zCI9jI31ZSdoKeGF+j2HkVfxB8DSUal3g3 q3TMWHWpKDzIBr4FLAulN0a6xHhgMCihm2IQgP46TTYRXITOdiwb1I2o6BwpvXoAng0o xTIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a+UgKZ0+udlx74VJNb+0/+rhHWvWP3izJjM4mnHUgJM=; b=RSNvpzLas4k/TOwOIv3eVBZCvrFxkzri7a6DP7vzwfuXxooQopB3RO9MdU9FZ85BXz OMyp8aWj2urrU5Iv/AYCnp7ADILNx0ZjUB3aMoGOEs7jRuKso4r7fT+RoWmxxhbR9Wb2 kApQhsr/w273DFwgFdq3/WfQYKcwBfRWjDofWWHzRGYysQWUXpcAsZuTrDe0iqTV7C3m 8U2NY9UNnD+2AUn/kb3dtz/eFC3JyieOhnqiamaq62DscV59j8SGOflqFNbwKwecyg8F 5Nld0ntmAtgieWDf5dGYqxtPsddeNDP+TTuX0Eg8y/EZD5r07Sab9KiSDtveJFAs2SjM qgWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qpfzTr62; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si6387388pgd.176.2019.03.22.04.24.12; Fri, 22 Mar 2019 04:24:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qpfzTr62; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728267AbfCVLVc (ORCPT + 99 others); Fri, 22 Mar 2019 07:21:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:47980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728589AbfCVLV3 (ORCPT ); Fri, 22 Mar 2019 07:21:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D0B5218A2; Fri, 22 Mar 2019 11:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253688; bh=j1ptw1Sp0B7w15N9QVLk+6+7gSq8LA6/4OrJRnkF9VU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qpfzTr62Pu3GQABGRK2K1fiEsjKEN0nZypglqmr7Kl0W2Ffi+dXwgP4/1Yo62DZyx wq2TGvDrhEw7H1T1b9nkxyfJ/VZwGFU4IwuyXtQ31Op4rBjKC/QZRepkn7gOBqA8se oLHuhdWAt7IiLdJ1LuqYPSWOL2b3ifLcA96sDlpI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianlin Shi , Oussama Ghorbel , Hangbin Liu , Stefano Brivio , "David S. Miller" Subject: [PATCH 3.18 023/134] sit: check if IPv6 enabled before calling ip6_err_gen_icmpv6_unreach() Date: Fri, 22 Mar 2019 12:13:56 +0100 Message-Id: <20190322111211.529741395@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hangbin Liu [ Upstream commit 173656accaf583698bac3f9e269884ba60d51ef4 ] If we disabled IPv6 from the kernel command line (ipv6.disable=1), we should not call ip6_err_gen_icmpv6_unreach(). This: ip link add sit1 type sit local 192.0.2.1 remote 192.0.2.2 ttl 1 ip link set sit1 up ip addr add 198.51.100.1/24 dev sit1 ping 198.51.100.2 if IPv6 is disabled at boot time, will crash the kernel. v2: there's no need to use in6_dev_get(), use __in6_dev_get() instead, as we only need to check that idev exists and we are under rcu_read_lock() (from netif_receive_skb_internal()). Reported-by: Jianlin Shi Fixes: ca15a078bd90 ("sit: generate icmpv6 error when receiving icmpv4 error") Cc: Oussama Ghorbel Signed-off-by: Hangbin Liu Reviewed-by: Stefano Brivio Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/sit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -577,7 +577,7 @@ static int ipip6_err(struct sk_buff *skb goto out; err = 0; - if (!ipip6_err_gen_icmpv6_unreach(skb)) + if (__in6_dev_get(skb->dev) && !ipip6_err_gen_icmpv6_unreach(skb)) goto out; if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED)