lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 2 Feb 2021 09:36:54 +0800
From:   Sun Ke <sunke32@...wei.com>
To:     Markus Elfring <Markus.Elfring@....de>,
        Josef Bacik <josef@...icpanda.com>,
        Jens Axboe <axboe@...nel.dk>, <linux-block@...r.kernel.org>,
        <nbd@...er.debian.org>
CC:     <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH v2] nbd: Fix NULL pointer in flush_workqueue

hi,Markus

在 2021/2/2 3:05, Markus Elfring 写道:
> …
>> +++ b/drivers/block/nbd.c
>> @@ -2011,12 +2011,14 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
>>   		       index);
>>   		return -EINVAL;
>>   	}
>> +	mutex_lock(&nbd->config_lock);
>>   	if (!refcount_inc_not_zero(&nbd->refs)) {
>> -		mutex_unlock(&nbd_index_mutex);
>> -		printk(KERN_ERR "nbd: device at index %d is going down\n",
>> -		       index);
>> -		return -EINVAL;
>> +		goto unlock;
>>   	}
>> +	if (!nbd->recv_workq) {
>> +		goto unlock;
>> +	}
> How do you think about to use the following patch variant
> (so that unwanted curly brackets would be avoided for proposed single statements
> in two if branches)?
>
> +	mutex_lock(&nbd->config_lock);
> -	if (!refcount_inc_not_zero(&nbd->refs)) {
> +	if (!refcount_inc_not_zero(&nbd->refs) || !nbd->recv_workq) {
> +		mutex_unlock(&nbd->config_lock);
>   		mutex_unlock(&nbd_index_mutex);
>   		printk(KERN_ERR "nbd: device at index %d is going down\n",tter
>   		       index);
>   		return -EINVAL;
>   	}
It looks better,  thanks for your suggestion.
>
> By the way:
> Would you like to replace the following two statements by the statement
> “goto put_nbd;” in another update step for this function implementation?
>
> 		nbd_put(nbd);
> 		return 0;
Sure, I will do it.
>
> Regards,
> Markus

Thanks,

Sun Ke

> .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ