aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-01-16 22:06:35 +0000
committerMark Brown <broonie@kernel.org>2015-01-16 22:06:35 +0000
commitc293f79246d7cdaf6e75b40aa1f957eb8d195835 (patch)
tree2559c41e0baa8e0f160ce033e1b4c245d0ce0dcf /block
parent2156eda2aafa0b0f660656246a11d7c2a9947ff9 (diff)
parent5054319d9fe56ed1ef6c83c00ae37fdc2b277a79 (diff)
Merge tag 'v3.10.65' into linux-linaro-lsk
This is the 3.10.65 stable release
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 4700248b32e9..ea49f8631c22 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1070,9 +1070,16 @@ int disk_expand_part_tbl(struct gendisk *disk, int partno)
struct disk_part_tbl *old_ptbl = disk->part_tbl;
struct disk_part_tbl *new_ptbl;
int len = old_ptbl ? old_ptbl->len : 0;
- int target = partno + 1;
+ int i, target;
size_t size;
- int i;
+
+ /*
+ * check for int overflow, since we can get here from blkpg_ioctl()
+ * with a user passed 'partno'.
+ */
+ target = partno + 1;
+ if (target < 0)
+ return -EINVAL;
/* disk_max_parts() is zero during initialization, ignore if so */
if (disk_max_parts(disk) && target > disk_max_parts(disk))