block: don't add or resize partition on the disk with GENHD_FL_NO_PART
authorLi Lingfeng <lilingfeng3@huawei.com>
Thu, 31 Aug 2023 07:59:00 +0000 (15:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:43:02 +0000 (09:43 +0200)
commit5e4e9900e6fa61302c26d028830b271997bf329f
tree412647cbc17faccfd531e1077a195faf38ac2c47
parent1654635bed834a5914b036a3657ba1a8bf8bf582
block: don't add or resize partition on the disk with GENHD_FL_NO_PART

commit 1a721de8489fa559ff4471f73c58bb74ac5580d3 upstream.

Commit a33df75c6328 ("block: use an xarray for disk->part_tbl") remove
disk_expand_part_tbl() in add_partition(), which means all kinds of
devices will support extended dynamic `dev_t`.
However, some devices with GENHD_FL_NO_PART are not expected to add or
resize partition.
Fix this by adding check of GENHD_FL_NO_PART before add or resize
partition.

Fixes: a33df75c6328 ("block: use an xarray for disk->part_tbl")
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230831075900.1725842-1-lilingfeng@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/ioctl.c