diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:15 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:59 -0400 |
commit | 07f9479a40cc778bc1462ada11f95b01360ae4ff (patch) | |
tree | 0676cf38df3844004bb3ebfd99dfa67a4a8998f5 /fs/partitions | |
parent | 9d5e6bdb3013acfb311ab407eeca0b6a6a3dedbf (diff) | |
parent | cd2e49e90f1cae7726c9a2c54488d881d7f1cd1c (diff) |
Merge branch 'master' into for-next
Fast-forwarded to current state of Linus' tree as there are patches to be
applied for files that didn't exist on the old branch.
Diffstat (limited to 'fs/partitions')
-rw-r--r-- | fs/partitions/check.c | 7 | ||||
-rw-r--r-- | fs/partitions/ldm.c | 16 |
2 files changed, 16 insertions, 7 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 9c21119512b9..d545e97d99c3 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -290,7 +290,8 @@ ssize_t part_inflight_show(struct device *dev, | |||
290 | { | 290 | { |
291 | struct hd_struct *p = dev_to_part(dev); | 291 | struct hd_struct *p = dev_to_part(dev); |
292 | 292 | ||
293 | return sprintf(buf, "%8u %8u\n", p->in_flight[0], p->in_flight[1]); | 293 | return sprintf(buf, "%8u %8u\n", atomic_read(&p->in_flight[0]), |
294 | atomic_read(&p->in_flight[1])); | ||
294 | } | 295 | } |
295 | 296 | ||
296 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 297 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
@@ -499,7 +500,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
499 | /* everything is up and running, commence */ | 500 | /* everything is up and running, commence */ |
500 | rcu_assign_pointer(ptbl->part[partno], p); | 501 | rcu_assign_pointer(ptbl->part[partno], p); |
501 | 502 | ||
502 | /* suppress uevent if the disk supresses it */ | 503 | /* suppress uevent if the disk suppresses it */ |
503 | if (!dev_get_uevent_suppress(ddev)) | 504 | if (!dev_get_uevent_suppress(ddev)) |
504 | kobject_uevent(&pdev->kobj, KOBJ_ADD); | 505 | kobject_uevent(&pdev->kobj, KOBJ_ADD); |
505 | 506 | ||
@@ -584,7 +585,7 @@ rescan: | |||
584 | /* | 585 | /* |
585 | * If any partition code tried to read beyond EOD, try | 586 | * If any partition code tried to read beyond EOD, try |
586 | * unlocking native capacity even if partition table is | 587 | * unlocking native capacity even if partition table is |
587 | * sucessfully read as we could be missing some partitions. | 588 | * successfully read as we could be missing some partitions. |
588 | */ | 589 | */ |
589 | if (state->access_beyond_eod) { | 590 | if (state->access_beyond_eod) { |
590 | printk(KERN_WARNING | 591 | printk(KERN_WARNING |
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index ea648b913beb..410df07ae96d 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
@@ -1299,6 +1299,11 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags) | |||
1299 | 1299 | ||
1300 | BUG_ON (!data || !frags); | 1300 | BUG_ON (!data || !frags); |
1301 | 1301 | ||
1302 | if (size < 2 * VBLK_SIZE_HEAD) { | ||
1303 | ldm_error("Value of size is to small."); | ||
1304 | return false; | ||
1305 | } | ||
1306 | |||
1302 | group = get_unaligned_be32(data + 0x08); | 1307 | group = get_unaligned_be32(data + 0x08); |
1303 | rec = get_unaligned_be16(data + 0x0C); | 1308 | rec = get_unaligned_be16(data + 0x0C); |
1304 | num = get_unaligned_be16(data + 0x0E); | 1309 | num = get_unaligned_be16(data + 0x0E); |
@@ -1306,6 +1311,10 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags) | |||
1306 | ldm_error ("A VBLK claims to have %d parts.", num); | 1311 | ldm_error ("A VBLK claims to have %d parts.", num); |
1307 | return false; | 1312 | return false; |
1308 | } | 1313 | } |
1314 | if (rec >= num) { | ||
1315 | ldm_error("REC value (%d) exceeds NUM value (%d)", rec, num); | ||
1316 | return false; | ||
1317 | } | ||
1309 | 1318 | ||
1310 | list_for_each (item, frags) { | 1319 | list_for_each (item, frags) { |
1311 | f = list_entry (item, struct frag, list); | 1320 | f = list_entry (item, struct frag, list); |
@@ -1334,10 +1343,9 @@ found: | |||
1334 | 1343 | ||
1335 | f->map |= (1 << rec); | 1344 | f->map |= (1 << rec); |
1336 | 1345 | ||
1337 | if (num > 0) { | 1346 | data += VBLK_SIZE_HEAD; |
1338 | data += VBLK_SIZE_HEAD; | 1347 | size -= VBLK_SIZE_HEAD; |
1339 | size -= VBLK_SIZE_HEAD; | 1348 | |
1340 | } | ||
1341 | memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size); | 1349 | memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size); |
1342 | 1350 | ||
1343 | return true; | 1351 | return true; |