mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	block: use after free bug in __blkdev_get
commit0762b8bde9(from 14 months ago) introduced a use-after-free bug which has just recently started manifesting in my md testing. I tried git bisect to find out what caused the bug to start manifesting, and it could have been the recent change to blk_unregister_queue (48c0d4d4c0) but the results were inconclusive. This patch certainly fixes my symptoms and looks correct as the two calls are now in the same order as elsewhere in that function. Signed-off-by: NeilBrown <neilb@suse.de> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
		
							parent
							
								
									6cafb12dc8
								
							
						
					
					
						commit
						960cc0f4fe
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -1248,8 +1248,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | ||||||
| 			bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); | 			bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		put_disk(disk); |  | ||||||
| 		module_put(disk->fops->owner); | 		module_put(disk->fops->owner); | ||||||
|  | 		put_disk(disk); | ||||||
| 		disk = NULL; | 		disk = NULL; | ||||||
| 		if (bdev->bd_contains == bdev) { | 		if (bdev->bd_contains == bdev) { | ||||||
| 			if (bdev->bd_disk->fops->open) { | 			if (bdev->bd_disk->fops->open) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Neil Brown
						Neil Brown