Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp388484pxj; Thu, 20 May 2021 11:38:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeCmMAD659y8t7pWm+M8eyPAUe7XPIUeIR+IJ/gEwjN5fCfC+CSM+aKtfLh8BaFLtVR5LL X-Received: by 2002:a92:d24a:: with SMTP id v10mr6545023ilg.247.1621535896328; Thu, 20 May 2021 11:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621535896; cv=none; d=google.com; s=arc-20160816; b=BpaG2R9HFYWpNdyf/xS5CpPSm8LNOGZGlY1mnehKWewl65ELTfDndromvl/GFW1s6p tm2C5wmXyXv5MWtPCzMEn29VNPjZ49nprbp3b8TlpmCoXzSQvYL6huwxHHDpgVAqBeAS 9FS1eHFSY6b1V5VybS/sr9/UkrY3lBMPU+IJX+dcI7DD09P+C+9ZXTdPOHebKAAr7Gx3 YS2/PNlPJ5vfCkwFK2YWYY9c+mXnWduScKtQn2b4YwkWNNlC1iZAmfNXTr2SnIg0IMuI zXThbWuzZxplUxveG+ZHovnMHMS1UOyskFi5/6Sz/0nujpRiL5O/XPpDJhski0+Jf03W oCQw== 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=jFOHrYlKd2PCHXkaMKNsgj/pnRQJpEryKwBvaec/YWc=; b=iUhwqiOMBD0iOQNRxaJJjeSn3krwU4ZPecu81ZWzeqNeLxV+y3f5ZrgH/Sq5E5z4G3 3gagvWIie5qhnMqgDVi7s4JrcAHHZt9nkYp7yVfC8ujl0B5dr6Hgmc5duibFoCnRILjH jFQo7yg0ZcHR4TKWIhjtZ5rAJ1TayQuvhv2SJdnmMm9tsLv6kAz4g4kP/L+8wzJGoSxd Y9JURuH4ztJnyjKzK0A5MfQspBhEtSwOSFpsVE0bfYFa7QcRoQHpi0AmpFEQopiZ4nnC vfyRffO81WvqP6cDYMJjgHpo5LAzx9I/yTY034PAGC3iL/Rc6GN2WEa64TzgxKUqUO5+ fhZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xe2Z/eEb"; 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 7si3127608ilz.34.2021.05.20.11.38.03; Thu, 20 May 2021 11:38:16 -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="xe2Z/eEb"; 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 S236547AbhETKZR (ORCPT + 99 others); Thu, 20 May 2021 06:25:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:47660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236161AbhETKO3 (ORCPT ); Thu, 20 May 2021 06:14:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 48F8F61972; Thu, 20 May 2021 09:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503880; bh=31IfYWV6K9GziwTk3t6vQNdd60MuemF/RY8rzmXM+p0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xe2Z/eEbhsbCKatIgJjq4MqFe4ICT3B9G9FBXFScsHOGOv0c0YeM7BFQxsx6tDOfj LlRFvVxjxe5LLPFO4aKZPUWAxhnwL+2Xzl6XADNFzMjR1zWyvrHlTGG6t94motg5s8 WAYGZd/LPGheJtprzGtIgn3IWlYDdBicb43DGiM4= 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.19 421/425] ipv6: remove extra dev_hold() for fallback tunnels Date: Thu, 20 May 2021 11:23:10 +0200 Message-Id: <20210520092145.235912258@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@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 @@ -392,7 +392,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; @@ -1546,8 +1545,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 @@ -1909,7 +1909,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 @@ -956,7 +956,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 @@ -1421,7 +1421,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); }