Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1533583ybl; Thu, 5 Dec 2019 03:02:00 -0800 (PST) X-Google-Smtp-Source: APXvYqw2tULNpAlBi1MG3BZNVG04ElbF6ZxN3+C68QNyOCoYF7XSdA2q6yShXAb+8LEaJclB300O X-Received: by 2002:aca:d803:: with SMTP id p3mr869059oig.13.1575543720735; Thu, 05 Dec 2019 03:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575543720; cv=none; d=google.com; s=arc-20160816; b=exZtDcUHLk3r1boWHuzQFWoA5IMSP/ODZ2Zj/8o2xLoYsKZERCeaye82hz3fxMCWXK K/ecVkGZ0EJv1NyD9e35yO7JiFEUCZdlkhArD6Zu8HgcK94AeBP4C3pTgOwqcx4m0b8Q reemy14g/CGbBKUMAE63DisktTsp+Un027p4gFGzxWQe+Zibq0WHNocJukQQpBR95HLi O0OBRXQSADBWjlQe6+EMpVvN9tmgqBaF5tprymOCR6IdFXWvzQHOQRTnDTIGt1Q9j1yc RVRdQ7rnxdvpafKFgjv3Egm9B70o4Qc9wZhUi5EqaxrDKLaeWPlOfIVv2UTf0waIedun JNIg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=MOeq45yV3QzOpIXQ+bGfFNjTUBrrCz1Gw0h/TmwdYgo=; b=R1snumvAr4fxypjKX3M/JqBCLTsZ6L1dTBL1d3tuJ2Qyxi8FVIPRviKbv/ZUHGf1bZ YOzZx2vXMVtgvQyPo+jfLmp3/Wb0q+n8ABlt6Y37MtBxrsyYQaZjPcUu7U+rG5y7lgGM xHid/rhnymM+iZoGlSWwRgnV8mY54VkXjJc4hJFh9meaQ7Mfx0BCA/kCHvnosqQL2W4s vwBkZQ9ibsIoLs4L4dqFz6kLwKhKK/HTi0zAgE2ROrzN2byVvj4G45Atmtx5DDUktIas p4En+ywXY/yNBnRKBi0npedIC4G/cf6RDHVd5OlCH4KkKoLkrSHI1utR1xO+oWVKUAbG yZ/Q== 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 r26si4104234otc.163.2019.12.05.03.01.47; Thu, 05 Dec 2019 03:02:00 -0800 (PST) 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 S1729290AbfLELBO (ORCPT + 99 others); Thu, 5 Dec 2019 06:01:14 -0500 Received: from www262.sakura.ne.jp ([202.181.97.72]:53793 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728735AbfLELBN (ORCPT ); Thu, 5 Dec 2019 06:01:13 -0500 Received: from fsav109.sakura.ne.jp (fsav109.sakura.ne.jp [27.133.134.236]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id xB5B0ZXE069614; Thu, 5 Dec 2019 20:00:35 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav109.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav109.sakura.ne.jp); Thu, 05 Dec 2019 20:00:35 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav109.sakura.ne.jp) Received: from [192.168.1.9] (softbank126040062084.bbtec.net [126.40.62.84]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id xB5B0Zfm069611 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NO); Thu, 5 Dec 2019 20:00:35 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: unregister_netdevice: waiting for DEV to become free (2) To: =?UTF-8?Q?Jouni_H=c3=b6gander?= Cc: syzbot , YueHaibing , Julian Anastasov , ddstreet@ieee.org, dvyukov@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com, Hulk Robot , "David S. Miller" , Lukas Bulwahn References: <0000000000007d22100573d66078@google.com> <87y2vrgkij.fsf@unikie.com> From: Tetsuo Handa Message-ID: Date: Thu, 5 Dec 2019 20:00:35 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <87y2vrgkij.fsf@unikie.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/05 19:00, Jouni Högander wrote: >> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c >> index ae3bcb1540ec..562d06c274aa 100644 >> --- a/net/core/net-sysfs.c >> +++ b/net/core/net-sysfs.c >> @@ -1459,14 +1459,14 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index) >> struct kobject *kobj = &queue->kobj; >> int error = 0; >> >> + dev_hold(queue->dev); >> + >> kobj->kset = dev->queues_kset; >> error = kobject_init_and_add(kobj, &netdev_queue_ktype, NULL, >> "tx-%u", index); >> if (error) >> goto err; >> >> - dev_hold(queue->dev); >> - >> #ifdef CONFIG_BQL >> error = sysfs_create_group(kobj, &dql_group); >> if (error) > > Now after reproducing the issue I think this is actually proper fix for > the issue. It's not related to missing error handling in in > tun_set_real_num_queues as I commented earlier. Can you prepare patch > for this? You can write the patch; I don't know about commit a3e23f719f5c4a38 ("net-sysfs: call dev_hold if kobject_init_and_add success"). I was wondering how can the caller tell whether to drop the refcount, for the caller won't be able to know which one (kobject_init_and_add() or sysfs_create_group()) returned an error. Therefore, always taking the refcount seems to be a proper fix...