projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2045e88
)
dm log: ensure log bitmap fits on log device
author
Milan Broz
<
[email protected]
>
Tue, 6 Jan 2009 03:05:02 +0000
(
03:05
+0000)
committer
Alasdair G Kergon
<
[email protected]
>
Tue, 6 Jan 2009 03:05:02 +0000
(
03:05
+0000)
Check that the log bitmap will fit within the log device.
Signed-off-by: Milan Broz <
[email protected]
>
Signed-off-by: Alasdair G Kergon <
[email protected]
>
drivers/md/dm-log.c
patch
|
blob
|
history
diff --git
a/drivers/md/dm-log.c
b/drivers/md/dm-log.c
index 40ed70df6736754dc378df65ab3c6035c2246f72..737961f275c196f9b6aa41957dd08c72457c597b 100644
(file)
--- a/
drivers/md/dm-log.c
+++ b/
drivers/md/dm-log.c
@@
-457,6
+457,14
@@
static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
*/
buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) +
bitset_size, ti->limits.hardsect_size);
+
+ if (buf_size > dev->bdev->bd_inode->i_size) {
+ DMWARN("log device %s too small: need %llu bytes",
+ dev->name, (unsigned long long)buf_size);
+ kfree(lc);
+ return -EINVAL;
+ }
+
lc->header_location.count = buf_size >> SECTOR_SHIFT;
lc->io_req.mem.type = DM_IO_VMA;