Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp38400pxj; Thu, 20 May 2021 04:05:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz/PLan3V5qvhetPbtzFLnlDrQX21d30Wr7WhnlJXb0ewTruxVT07Haoyg0wxKkf+BfhTO X-Received: by 2002:a17:906:40d1:: with SMTP id a17mr4067652ejk.43.1621508703981; Thu, 20 May 2021 04:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508703; cv=none; d=google.com; s=arc-20160816; b=d8pD6q8Og5tLaZjVJAy6PXX55g1GVeARLSoLmkZj1Sc4XQIjGesl66oKyMnp/FB891 q3YhovzdGAKBbwk3BduXNG1iPE1qTnnXTOIFBcRj6dr3gWsaGS8/a05cYMZvTq0hRze7 nFu8uVR0aYI7LtuWqZEM63H+/rtFKhL/jlAQvRJ41QxHQ7dJAdEgckdaoYq1z9ZAXphM /S9i7ejGkILyRonnTFWaFUAsnyg2Ri5f2YZV6LrmROj3znel0q5XEDGrIVHjzoMkbb3n oPYYs4C2JQpSf1l9PerY2BkkOe3hrDAWzS50iNi/egv8e7WkPOJaL1V439A66xJFQxSQ U3Fg== 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=1yyJmaEiJnzalIlk8SzAGZWr8u+SbCraBa/wlxRpRRY=; b=eaYmdOOPD83hrv6tIBDC9jw89keyWAZQC473gPSc4bjpbr2aP5mpRSX0/4Iz43W+XO 9Y9EQ2t3jsxYfxOe/GJW5RA7oWhvrJIcB1SxG/S6LdpeUX4lxjuBJRkjIkEJtgeNufEk YdtPqkPSu0PFdATWSdwvkpimuV98Co5xXDlqr7TL+1dj4kgvaA6yMNuWuRczVHMkwy3z KRuPaTxm7d3FaGoYU1Iuj2wJ5TJ3O5vSDCjFOO2x6Va65YWEnCx2tXk728wdZ/he3bu7 r2j3s+oV2Y9FboVBT1FzmP/NRTt8MDUqE4ad6pdnYzo5c/CZyhlypc4xVdxTYyKrAegn X3hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t+MwwIT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 j10si938815edw.296.2021.05.20.04.04.31; Thu, 20 May 2021 04:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=t+MwwIT6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S238481AbhETLBW (ORCPT + 99 others); Thu, 20 May 2021 07:01:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:44544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236113AbhETKn0 (ORCPT ); Thu, 20 May 2021 06:43:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 905DB61429; Thu, 20 May 2021 09:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504607; bh=BFRnI6vzCgVT3DYw8YAxwW+Dxt1m4o+N2XErRg2k3l8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+MwwIT6nE8Vf+cjroFZVviIYe2u0vqu1k44XvqnRUworAsas8a1yIZ7uJ43CGPY0 gj+jVjmxOdJyPcoW7n/9u8IXBrmONOSHzpWeMEoAZ4SHQI/QGhcGjVxKv7Cbxl9i8M bk7NJIzvD15X5gUj7zt13qR2VooPp+E/ZrtVhNh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , "David S. Miller" Subject: [PATCH 4.14 323/323] ipv6: remove extra dev_hold() for fallback tunnels Date: Thu, 20 May 2021 11:23:35 +0200 Message-Id: <20210520092131.317480667@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet commit 0d7a7b2014b1a499a0fe24c9f3063d7856b5aaaf upstream. My previous commits added a dev_hold() in tunnels ndo_init(), but forgot to remove it from special functions setting up fallback tunnels. Fallback tunnels do call their respective ndo_init() This leads to various reports like : unregister_netdevice: waiting for ip6gre0 to become free. Usage count = 2 Fixes: 48bb5697269a ("ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods") Fixes: 6289a98f0817 ("sit: proper dev_{hold|put} in ndo_[un]init methods") Fixes: 40cb881b5aaa ("ip6_vti: proper dev_{hold|put} in ndo_[un]init methods") Fixes: 7f700334be9a ("ip6_gre: proper dev_{hold|put} in ndo_[un]init methods") Signed-off-by: Eric Dumazet Reported-by: syzbot Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_gre.c | 3 --- net/ipv6/ip6_tunnel.c | 1 - net/ipv6/ip6_vti.c | 1 - net/ipv6/sit.c | 1 - 4 files changed, 6 deletions(-) --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -350,7 +350,6 @@ static struct ip6_tnl *ip6gre_tunnel_loc if (!(nt->parms.o_flags & TUNNEL_SEQ)) dev->features |= NETIF_F_LLTX; - dev_hold(dev); ip6gre_tunnel_link(ign, nt); return nt; @@ -1124,8 +1123,6 @@ static void ip6gre_fb_tunnel_init(struct strcpy(tunnel->parms.name, dev->name); tunnel->hlen = sizeof(struct ipv6hdr) + 4; - - dev_hold(dev); } --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1905,7 +1905,6 @@ static int __net_init ip6_fb_tnl_dev_ini struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); t->parms.proto = IPPROTO_IPV6; - dev_hold(dev); rcu_assign_pointer(ip6n->tnls_wc[0], t); return 0; --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -934,7 +934,6 @@ static int __net_init vti6_fb_tnl_dev_in struct vti6_net *ip6n = net_generic(net, vti6_net_id); t->parms.proto = IPPROTO_IPV6; - dev_hold(dev); rcu_assign_pointer(ip6n->tnls_wc[0], t); return 0; --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1407,7 +1407,6 @@ static void __net_init ipip6_fb_tunnel_i iph->ihl = 5; iph->ttl = 64; - dev_hold(dev); rcu_assign_pointer(sitn->tunnels_wc[0], tunnel); }