From: Sun Ke <sunke32@huawei.com>
To: Markus Elfring <Markus.Elfring@web.de>,
<linux-block@vger.kernel.org>, <nbd@other.debian.org>
Cc: <linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>,
"Jens Axboe" <axboe@kernel.dk>,
Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH] nbd: Fix NULL pointer in flush_workqueue
Date: Mon, 1 Feb 2021 14:43:00 +0800 [thread overview]
Message-ID: <28c83b00-7d0b-ee0d-640b-017c9f8410eb@huawei.com> (raw)
In-Reply-To: <1739e522-5980-f86e-cb90-19b61539a5cf@web.de>
hi,Markus
在 2021/1/29 3:42, Markus Elfring 写道:
> …
>> +++ b/drivers/block/nbd.c
>> @@ -2011,12 +2011,20 @@ 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);
>> + mutex_unlock(&nbd->config_lock);
> Can an other function call order become relevant for the unlocking of these mutexes?
Do you think the nbd->config_lock mutex here is useless?
>
>
>> printk(KERN_ERR "nbd: device at index %d is going down\n",
>> index);
> May such an error message be moved into the lock scope?
Sure.
>
>
>> return -EINVAL;
>> }
>> + if (!nbd->recv_workq) {
>> + mutex_unlock(&nbd->config_lock);
>> + mutex_unlock(&nbd_index_mutex);
>> + return -EINVAL;
>> + }
> How do you think about to connect the code from this if branch
> with a jump target like “unlock” so that such statements would be shareable
> for the desired exception handling?
OK, I will improve it in V2 patch.
>
>
>> + mutex_unlock(&nbd->config_lock);
>> mutex_unlock(&nbd_index_mutex);
>> if (!refcount_inc_not_zero(&nbd->config_refs)) {
>> nbd_put(nbd);
>
> Regards,
> Markus
> .
prev parent reply other threads:[~2021-02-01 6:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 7:41 Sun Ke
[not found] ` <1739e522-5980-f86e-cb90-19b61539a5cf@web.de>
2021-02-01 6:43 ` Sun Ke [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28c83b00-7d0b-ee0d-640b-017c9f8410eb@huawei.com \
--to=sunke32@huawei.com \
--cc=Markus.Elfring@web.de \
--cc=axboe@kernel.dk \
--cc=josef@toxicpanda.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@other.debian.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®