diff options
author | Anton Altaparmakov <anton@tuxera.com> | 2012-02-24 04:37:42 -0500 |
---|---|---|
committer | Anton Altaparmakov <anton@tuxera.com> | 2012-02-24 04:37:42 -0500 |
commit | 97387e3baaf3c35ad560f8878e943c720a77da1b (patch) | |
tree | fb7ca5625edc0693388a1355b85ed62fc8a5b221 /block | |
parent | 9b556248ecb059095e000f77c4b84899feb50098 (diff) |
LDM: Fix reassembly of extended VBLKs.
From: Ben Hutchings <ben@decadent.org.uk>
Extended VBLKs (those larger than the preset VBLK size) are divided
into fragments, each with its own VBLK header. Our LDM implementation
generally assumes that each VBLK is contiguous in memory, so these
fragments must be assembled before further processing.
Currently the reassembly seems to be done quite wrongly - no VBLK
header is copied into the contiguous buffer, and the length of the
header is subtracted twice from each fragment. Also the total
length of the reassembled VBLK is calculated incorrectly.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Anton Altaparmakov <anton@tuxera.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/partitions/ldm.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c index bd8ae788f689..e507cfbd044e 100644 --- a/block/partitions/ldm.c +++ b/block/partitions/ldm.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) | 2 | * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) |
3 | * | 3 | * |
4 | * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> | 4 | * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> |
5 | * Copyright (c) 2001-2007 Anton Altaparmakov | 5 | * Copyright (c) 2001-2012 Anton Altaparmakov |
6 | * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> | 6 | * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> |
7 | * | 7 | * |
8 | * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads | 8 | * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads |
@@ -1341,20 +1341,17 @@ found: | |||
1341 | ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num); | 1341 | ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num); |
1342 | return false; | 1342 | return false; |
1343 | } | 1343 | } |
1344 | |||
1345 | if (f->map & (1 << rec)) { | 1344 | if (f->map & (1 << rec)) { |
1346 | ldm_error ("Duplicate VBLK, part %d.", rec); | 1345 | ldm_error ("Duplicate VBLK, part %d.", rec); |
1347 | f->map &= 0x7F; /* Mark the group as broken */ | 1346 | f->map &= 0x7F; /* Mark the group as broken */ |
1348 | return false; | 1347 | return false; |
1349 | } | 1348 | } |
1350 | |||
1351 | f->map |= (1 << rec); | 1349 | f->map |= (1 << rec); |
1352 | 1350 | if (!rec) | |
1351 | memcpy(f->data, data, VBLK_SIZE_HEAD); | ||
1353 | data += VBLK_SIZE_HEAD; | 1352 | data += VBLK_SIZE_HEAD; |
1354 | size -= VBLK_SIZE_HEAD; | 1353 | size -= VBLK_SIZE_HEAD; |
1355 | 1354 | memcpy(f->data + VBLK_SIZE_HEAD + rec * size, data, size); | |
1356 | memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size); | ||
1357 | |||
1358 | return true; | 1355 | return true; |
1359 | } | 1356 | } |
1360 | 1357 | ||