Lv Yunlong 72ce11ddfa drivers/block/null_blk/main: Fix a double free in null_init.
In null_init, null_add_dev(dev) is called.
In null_add_dev, it calls null_free_zoned_dev(dev) to free dev->zones
via kvfree(dev->zones) in out_cleanup_zone branch and returns err.
Then null_init accept the err code and then calls null_free_dev(dev).

But in null_free_dev(dev), dev->zones is freed again by
null_free_zoned_dev().

My patch set dev->zones to NULL in null_free_zoned_dev() after
kvfree(dev->zones) is called, to avoid the double free.

Fixes: 2984c8684f962 ("nullb: factor disk parameters")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Link: https://lore.kernel.org/r/20210426143229.7374-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-04-26 09:04:40 -06:00
..
2021-02-26 15:49:51 -07:00
2021-03-13 11:27:31 -08:00
2021-02-28 11:23:38 -08:00
2021-03-24 06:57:40 -06:00
2021-01-24 18:15:57 -07:00
2021-04-06 09:30:09 -06:00
2021-04-06 09:29:47 -06:00
2021-02-25 12:21:08 -08:00