Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp242359pxj; Thu, 20 May 2021 08:25:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUoEdWwUNFBO2V1FD5DrhdkKqJcvnqpmRvLekS82KaN1kqz/XOF0T40fUkQHILxiz/misv X-Received: by 2002:a05:6e02:1250:: with SMTP id j16mr5859806ilq.217.1621524325976; Thu, 20 May 2021 08:25:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621524325; cv=none; d=google.com; s=arc-20160816; b=ClpnPTdjlPzSyuXe16SHVAa4Mn7QPvjFk+kWz4EJBF7HHd4KxOcNztfYVeHD1++BjL eFg5MMwioygVUFhLZB9C418bslWLXQOSubU1zst4oaKb1vhhy7ZUdIlvrHt2pC7DI/E6 O12EbcbQXMYnZj4t/Jg81HrD1yV+CslY9vfx0gjovg1cdTLcNrHXmz+pLqFQq6CQV/Xj 0P5wZlz25zaBjlMjpYVsHjg0RsVh5+ly7sQLH2Tpl1mOoiIb0a/63CFbXuNfdEUzWhLs O2mXqJ7ztIP+xQfOl1TGPKewe7LdDjlVwy5p4BQxZadyzYRvVcPW7uPtb3d9NLpXyad+ oU4Q== 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=kpWPYm0j7Jntpa7Y/XtnTyuvSns77UCTRVVp8SUxbeU=; b=fAbAKitdQocx5NWca7wGM26ECn1aGDpCK7+AXyuqOfoRoKgvwC6QlIWG5TVxa+vedn oCxgAGkvty+4QgXMb+4tnTZr+EGp8rJCs2ZQHtGmRQ2CRV6VydCGqBLnEtyXu5ZNZYDM vz92r5gcbsNzg3z3DS+s0jyiVP8QR70LuRtxm5f6jU1QJpV25MxNwXVReLcVtRSwrGtK ItJGKVsBoxp/98jNvc6jeYe7Yy0M+E4HPKyXT2MF7eXSb4y7G/YjsagB4ZJ87Saf2bzB 5R/0kFiD616kpeB4/4OsKrjsXie/Arjca+lztxRo01fW4D8AFF6rCvEPaBGJszKg+gsY g8ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uZ5/PWRA"; 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 t12si2596495jaj.66.2021.05.20.08.25.13; Thu, 20 May 2021 08:25:25 -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="uZ5/PWRA"; 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 S232748AbhETJgC (ORCPT + 99 others); Thu, 20 May 2021 05:36:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:35682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232445AbhETJdp (ORCPT ); Thu, 20 May 2021 05:33:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A3991613F9; Thu, 20 May 2021 09:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621502938; bh=8xMgb47kKdyhTkekxZ0R1r3HhfPW+PyNnzFz9iXQp2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZ5/PWRAIiCVKIAXlYNgpns2UFwVilRJ8z3+BurgKvNcnPQB1ccuSbn9PA9EixecG gxsKlhmkkgW2AUraEtIhrbSXSKaHO4aUX+D9QOHIwYoqyA2pz5LuBLDirTlwOu2gK7 FuN/xwX89cg0F/IRkJF5tb3nxP95q9FlyXPpg4O4= 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 5.4 34/37] ipv6: remove extra dev_hold() for fallback tunnels Date: Thu, 20 May 2021 11:22:55 +0200 Message-Id: <20210520092053.397626559@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092052.265851579@linuxfoundation.org> References: <20210520092052.265851579@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 @@ -387,7 +387,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; @@ -1526,8 +1525,6 @@ static void ip6gre_fb_tunnel_init(struct strcpy(tunnel->parms.name, dev->name); tunnel->hlen = sizeof(struct ipv6hdr) + 4; - - dev_hold(dev); } static struct inet6_protocol ip6gre_protocol __read_mostly = { --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1904,7 +1904,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 @@ -952,7 +952,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 @@ -1422,7 +1422,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); }