From: Ye Bin <yebin10@huawei.com>
To: <josef@toxicpanda.com>, <axboe@kernel.dk>,
<linux-block@vger.kernel.org>, <nbd@other.debian.org>
Cc: <linux-kernel@vger.kernel.org>, Ye Bin <yebin10@huawei.com>
Subject: [PATCH -next v3 1/2] nbd: Fix incorrect error handle when first_minor big than '0xff' in nbd_dev_add
Date: Fri, 29 Oct 2021 17:42:27 +0800 [thread overview]
Message-ID: <20211029094228.1853434-2-yebin10@huawei.com> (raw)
In-Reply-To: <20211029094228.1853434-1-yebin10@huawei.com>
If first_minor big than '0xff' goto out_free_idr label, this will miss
cleanup disk.
Fixes: b1a811633f73 ("block: nbd: add sanity check for first_minor")
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
drivers/block/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index b47b2a87ae8f..096883ab9b76 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1809,7 +1809,7 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
disk->first_minor = index << part_shift;
if (disk->first_minor > 0xff) {
err = -EINVAL;
- goto out_free_idr;
+ goto out_err_disk;
}
disk->minors = 1 << part_shift;
--
2.31.1
next prev parent reply other threads:[~2021-10-29 9:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 9:42 [PATCH -next v3 0/2] Fix hungtask when nbd_config_put Ye Bin
2021-10-29 9:42 ` Ye Bin [this message]
2021-10-29 14:34 ` [PATCH -next v3 1/2] nbd: Fix incorrect error handle when first_minor big than '0xff' in nbd_dev_add Josef Bacik
2021-10-29 9:42 ` [PATCH -next v3 2/2] nbd: Fix hungtask when nbd_config_put Ye Bin
2021-10-29 14:38 ` Josef Bacik
2021-11-01 6:29 [PATCH -next v3 0/2] " Ye Bin
2021-11-01 6:29 ` [PATCH -next v3 1/2] nbd: Fix incorrect error handle when first_minor big than '0xff' in nbd_dev_add Ye Bin
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=20211029094228.1853434-2-yebin10@huawei.com \
--to=yebin10@huawei.com \
--cc=axboe@kernel.dk \
--cc=josef@toxicpanda.com \
--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;
as well as URLs for NNTP newsgroup(s).