/block/ioctl.c and /fs/partition/check.c
PATCH 2/2 /block/ioctl.c and /fs/partition/check.c
check value returned by add_partion()
Signed-off-by Abdel Benamrouche <[email protected]>
--- block/ioctl.c | 5 +++-- fs/partitions/check.c | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-)
block/ioctl.c +3 -2
@@ -17,6 +17,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __userlong long start, length;int part;int i; +int err;if (!capable (CAP_SYS_ADMIN ))return -EACCES ;
@@ -61,9 +62,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user } }/* all seems OK */ -add_partition (disk, part, start, length,ADDPART_FLAG_NONE ); + err =add_partition (disk, part, start, length,ADDPART_FLAG_NONE );mutex_unlock (&bdev->bd_mutex); -return 0 ; +return err;case BLKPG_DEL_PARTITION :if (!disk->part[part-1 ])return -ENXIO ;
fs/partitions/check.c +7 -1
@@ -500,8 +500,14 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)if (from + size >get_capacity (disk)) {printk (" %s: p%d exceeds device capacity\n" , disk->disk_name, p); +continue ; + } + res =add_partition (disk, p, from, size, state->parts[p].flags); +if (res) { +printk (" %s: p%d could not be added. got error %d\n" , + disk->disk_name, p, -res); +continue ; } -add_partition (disk, p, from, size, state->parts[p].flags);#ifdef CONFIG_BLK_DEV_MD if (state->parts[p].flags &ADDPART_FLAG_RAID )md_autodetect_dev (bdev->bd_dev+p);
Signature · 1 line
1.5.4.3