mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	dm log: ensure log bitmap fits on log device
Check that the log bitmap will fit within the log device. Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
		
							parent
							
								
									2045e88edb
								
							
						
					
					
						commit
						ac1f0ac22c
					
				
					 1 changed files with 8 additions and 0 deletions
				
			
		|  | @ -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; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Milan Broz
						Milan Broz