From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] ipv6: fix a dst leak when removing its exception Date: Fri, 16 Nov 2018 19:45:28 -0800 (PST) Message-ID: <20181116.194528.2115277018889229926.davem@davemloft.net> References: Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, dsa@cumulusnetworks.com To: lucien.xin@gmail.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:48158 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729752AbeKQOAl (ORCPT ); Sat, 17 Nov 2018 09:00:41 -0500 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: From: Xin Long Date: Wed, 14 Nov 2018 00:48:28 +0800 > These is no need to hold dst before calling rt6_remove_exception_rt(). > The call to dst_hold_safe() in ip6_link_failure() was for ip6_del_rt(), > which has been removed in Commit 93531c674315 ("net/ipv6: separate > handling of FIB entries from dst based routes"). Otherwise, it will > cause a dst leak. > > This patch is to simply remove the dst_hold_safe() call before calling > rt6_remove_exception_rt() and also do the same in ip6_del_cached_rt(). > It's safe, because the removal of the exception that holds its dst's > refcnt is protected by rt6_exception_lock. > > Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes") > Fixes: 23fb93a4d3f1 ("net/ipv6: Cleanup exception and cache route handling") > Reported-by: Li Shuang > Signed-off-by: Xin Long Applied and queued up for -stable.