Message ID | 20201020081615.240305-3-xiubli@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | nbd: fix use-after-freed and double lock bugs | expand |
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)