lkml.org 
[lkml]   [2019]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: unregister_netdevice: waiting for DEV to become free (2)
From
Date
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...

\
 
 \ /
  Last update: 2019-12-05 12:02    [W:0.077 / U:0.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site