From: xiubli@redhat.com
To: josef@toxicpanda.com, axboe@kernel.dk
Cc: nbd@other.debian.org, linux-block@vger.kernel.org,
jdillama@redhat.com, mgolub@suse.de, Xiubo Li <xiubli@redhat.com>
Subject: [PATCH 2/2] nbd: fix double lock for nbd->config_lock
Date: Tue, 20 Oct 2020 04:16:15 -0400 [thread overview]
Message-ID: <20201020081615.240305-3-xiubli@redhat.com> (raw)
In-Reply-To: <20201020081615.240305-1-xiubli@redhat.com>
From: Xiubo Li <xiubli@redhat.com>
When NBD_CLEAR_SOCK with ioctl method, it will double lock the
config_lock.
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
drivers/block/nbd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 3d3f4255e495..b21abf134e34 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1358,9 +1358,7 @@ static void nbd_clear_sock_ioctl(struct nbd_device *nbd,
sock_shutdown(nbd);
__invalidate_device(bdev, true);
nbd_bdev_reset(bdev);
- if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
- &nbd->config->runtime_flags))
- nbd_config_put(nbd);
+ nbd_config_clear_rt_ref_and_put(nbd);
}
static bool nbd_is_valid_blksize(unsigned long blksize)
--
2.18.4
prev parent reply other threads:[~2020-10-20 8:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 8:16 [PATCH 0/2] nbd: fix use-after-freed and double lock bugs xiubli
2020-10-20 8:16 ` [PATCH 1/2] nbd: fix use-after-freed crash for nbd->recv_workq xiubli
2020-10-20 8:16 ` xiubli [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=20201020081615.240305-3-xiubli@redhat.com \
--to=xiubli@redhat.com \
--cc=axboe@kernel.dk \
--cc=jdillama@redhat.com \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=mgolub@suse.de \
--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;
as well as URLs for NNTP newsgroup(s).