mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 14:53:11 +01:00
block: don't add or resize partition on the disk with GENHD_FL_NO_PART
Commita33df75c63("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:a33df75c63("block: use an xarray for disk->part_tbl") Signed-off-by: Li Lingfeng <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
1 parent
0d997f1de8
commit
1a721de848
1 file changed
+2
@@ -20,6 +20,8 @@ static int blkpg_do_ioctl(struct block_device *bdev,
|
||||
struct blkpg_partition p;
|
||||
long long start, length;
|
||||
|
||||
if (disk->flags & GENHD_FL_NO_PART)
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
if (copy_from_user(&p, upart, sizeof(struct blkpg_partition)))
|
||||
|
||||
Reference in new issue
Block a user