Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp725498imm; Thu, 13 Sep 2018 06:53:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYndEcD6ZKD3lbAQwCDBWp9caDPYT8DHDxSd/ypylLrPa7oDXBOCXrrGBDWsM9t66On2+Ra X-Received: by 2002:a62:174a:: with SMTP id 71-v6mr7701194pfx.217.1536846800870; Thu, 13 Sep 2018 06:53:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846800; cv=none; d=google.com; s=arc-20160816; b=qRuF00+onbVvlswAnOZpI+pf8/FaV9kEHaseoA4JH6J0zusO7GDPA8t1vqXNQ/WN1N 2bS/VpOFMoSmKvKJhQVStDc4eUsyj2X5LJUeD0F9c59RxVs4uDBRAQglftVSpjEuzo1t V268oEuBLkILad+PeQbyWmoovHnkTNGhGwEbprwhmqxZeZQab33kAx308NQd5/YLltuv Wxt2fJFBTEN3cigaaucq040246BKMEebr+fNsJdL/L5mYkDY30iBUHHb/ihilcDuWR7g ExpFF1MQD1ICeleUwxJk+FdsNdlIonyHtmvn0lGxiK2plLHVdsjntQktAI/AwqICgr6I TKZA== 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; bh=rVlVODkY/1hCqQGc9iy+lao24xxLObD1g426SDtSfu4=; b=wU8us3I1V5q/yXI9X0OcfMo0Fb59jWZgPPExTCgNpvNJB5Zls59WeUiuA6LUe4gySQ zUr5qZmLNbn5WrKxjM+7A97ttu75RCQqLatNDny7xv3QXEDtFO/I/h7wmfQEeAmCf5RK hONifSkCTmM7wuhy6NFk+FKMTut1SMnhWd9XxOw5jZ8ZsQ6bziiRFxeWBVX61JygsTMf DxF5G+XDpmHRAIoxgyZ/7WrqThJV4m8JNFmyw6mAW260zx7RC5KqYTBMLdor6cmswEh0 mH3oTnBbi0UFoin+sB1+DNYsoTUgvPNaRKSp2BbDv2eqWOw/45Lx9pBMwReumnWdVUWY SFsg== ARC-Authentication-Results: i=1; mx.google.com; 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 17-v6si4090630pgw.648.2018.09.13.06.53.05; Thu, 13 Sep 2018 06:53:20 -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; 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 S1730817AbeIMTA7 (ORCPT + 99 others); Thu, 13 Sep 2018 15:00:59 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33290 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbeIMTA7 (ORCPT ); Thu, 13 Sep 2018 15:00:59 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 44D2DD1A; Thu, 13 Sep 2018 13:51:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kodanev , David Ahern , "David S. Miller" Subject: [PATCH 4.18 023/197] ipv6: dont get lwtstate twice in ip6_rt_copy_init() Date: Thu, 13 Sep 2018 15:29:32 +0200 Message-Id: <20180913131842.489266193@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Kodanev [ Upstream commit 93bbadd6e0a2a58e49d265b9b1aa58e621b60a26 ] Commit 80f1a0f4e0cd ("net/ipv6: Put lwtstate when destroying fib6_info") partially fixed the kmemleak [1], lwtstate can be copied from fib6_info, with ip6_rt_copy_init(), and it should be done only once there. rt->dst.lwtstate is set by ip6_rt_init_dst(), at the start of the function ip6_rt_copy_init(), so there is no need to get it again at the end. With this patch, lwtstate also isn't copied from RTF_REJECT routes. [1]: unreferenced object 0xffff880b6aaa14e0 (size 64): comm "ip", pid 10577, jiffies 4295149341 (age 1273.903s) hex dump (first 32 bytes): 01 00 04 00 04 00 00 00 10 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<0000000018664623>] lwtunnel_build_state+0x1bc/0x420 [<00000000b73aa29a>] ip6_route_info_create+0x9f7/0x1fd0 [<00000000ee2c5d1f>] ip6_route_add+0x14/0x70 [<000000008537b55c>] inet6_rtm_newroute+0xd9/0xe0 [<000000002acc50f5>] rtnetlink_rcv_msg+0x66f/0x8e0 [<000000008d9cd381>] netlink_rcv_skb+0x268/0x3b0 [<000000004c893c76>] netlink_unicast+0x417/0x5a0 [<00000000f2ab1afb>] netlink_sendmsg+0x70b/0xc30 [<00000000890ff0aa>] sock_sendmsg+0xb1/0xf0 [<00000000a2e7b66f>] ___sys_sendmsg+0x659/0x950 [<000000001e7426c8>] __sys_sendmsg+0xde/0x170 [<00000000fe411443>] do_syscall_64+0x9f/0x4a0 [<000000001be7b28b>] entry_SYSCALL_64_after_hwframe+0x49/0xbe [<000000006d21f353>] 0xffffffffffffffff Fixes: 6edb3c96a5f0 ("net/ipv6: Defer initialization of dst to data path") Signed-off-by: Alexey Kodanev Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/route.c | 1 - 1 file changed, 1 deletion(-) --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -996,7 +996,6 @@ static void ip6_rt_copy_init(struct rt6_ rt->rt6i_src = ort->fib6_src; #endif rt->rt6i_prefsrc = ort->fib6_prefsrc; - rt->dst.lwtstate = lwtstate_get(ort->fib6_nh.nh_lwtstate); } static struct fib6_node* fib6_backtrack(struct fib6_node *fn,