diff options
author | Gerald Schaefer <gerald.schaefer@de.ibm.com> | 2017-05-03 14:56:02 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-05-03 11:30:03 -0700 |
commit | 1ef97fe4f8abd3317d5c3c860f990e02c2633959 (patch) | |
tree | fd6400daa598e5f60d5c3502fa93c8fb5c2fd7e5 /drivers/block | |
parent | 67fd38973513c341c84654ae2f819089b840a39b (diff) | |
download | linux-stable-1ef97fe4f8abd3317d5c3c860f990e02c2633959.tar.gz linux-stable-1ef97fe4f8abd3317d5c3c860f990e02c2633959.tar.bz2 linux-stable-1ef97fe4f8abd3317d5c3c860f990e02c2633959.zip |
brd: fix uninitialized use of brd->dax_dev
commit 1647b9b9 "brd: add dax_operations support" introduced the allocation
and freeing of a dax_device, but the allocated dax_device is not stored
into the brd_device, so brd_del_one() will eventually operate on an
uninitialized brd->dax_dev.
Fix this by storing the allocated dax_device to brd->dax_dev.
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/brd.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index bfa4ed2c75ef..ec00c01b8dc3 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -453,9 +453,7 @@ static struct brd_device *brd_alloc(int i) { struct brd_device *brd; struct gendisk *disk; -#ifdef CONFIG_BLK_DEV_RAM_DAX - struct dax_device *dax_dev; -#endif + brd = kzalloc(sizeof(*brd), GFP_KERNEL); if (!brd) goto out; @@ -497,8 +495,8 @@ static struct brd_device *brd_alloc(int i) #ifdef CONFIG_BLK_DEV_RAM_DAX queue_flag_set_unlocked(QUEUE_FLAG_DAX, brd->brd_queue); - dax_dev = alloc_dax(brd, disk->disk_name, &brd_dax_ops); - if (!dax_dev) + brd->dax_dev = alloc_dax(brd, disk->disk_name, &brd_dax_ops); + if (!brd->dax_dev) goto out_free_inode; #endif @@ -507,8 +505,8 @@ static struct brd_device *brd_alloc(int i) #ifdef CONFIG_BLK_DEV_RAM_DAX out_free_inode: - kill_dax(dax_dev); - put_dax(dax_dev); + kill_dax(brd->dax_dev); + put_dax(brd->dax_dev); #endif out_free_queue: blk_cleanup_queue(brd->brd_queue); |