Skip to content

Commit

Permalink
hfsplus: fix overflow in hfsplus_read_wrapper
Browse files Browse the repository at this point in the history
For partitions larger than 2TB or at such an offset the hfs wrapper code
in hfsplus might overflow the range representable in a 32-bit
data type. Make sure we use a sector_t for the arithmetics leading to it.

I'm not sure this code can be readed at all as hfs itself never supported
such large volumes.

Signed-off-by: Christoph Hellwig <hch@tuxera.com>
  • Loading branch information
Christoph Hellwig authored and Christoph Hellwig committed Jun 30, 2011
1 parent bf1a1b3 commit 4ba2d5f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/hfsplus/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ int hfsplus_read_wrapper(struct super_block *sb)
if (!hfsplus_read_mdb(sbi->s_vhdr, &wd))
goto out_free_backup_vhdr;
wd.ablk_size >>= HFSPLUS_SECTOR_SHIFT;
part_start += wd.ablk_start + wd.embed_start * wd.ablk_size;
part_size = wd.embed_count * wd.ablk_size;
part_start += (sector_t)wd.ablk_start +
(sector_t)wd.embed_start * wd.ablk_size;
part_size = (sector_t)wd.embed_count * wd.ablk_size;
goto reread;
default:
/*
Expand Down

0 comments on commit 4ba2d5f

Please sign in to comment.