mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 05:12:49 +00:00
md: bcache: check the return value of kzalloc() in detached_dev_do_request()
The function kzalloc() in detached_dev_do_request() can fail, so its
return value should be checked.
Fixes: bc082a55d2
("bcache: fix inaccurate io state for detached bcache devices")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20220527152818.27545-4-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
7d6b902ea0
commit
40f567bbb3
1 changed files with 6 additions and 0 deletions
|
@ -1105,6 +1105,12 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
|
||||||
* which would call closure_get(&dc->disk.cl)
|
* which would call closure_get(&dc->disk.cl)
|
||||||
*/
|
*/
|
||||||
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
|
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
|
||||||
|
if (!ddip) {
|
||||||
|
bio->bi_status = BLK_STS_RESOURCE;
|
||||||
|
bio->bi_end_io(bio);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ddip->d = d;
|
ddip->d = d;
|
||||||
/* Count on the bcache device */
|
/* Count on the bcache device */
|
||||||
ddip->orig_bdev = orig_bdev;
|
ddip->orig_bdev = orig_bdev;
|
||||||
|
|
Loading…
Reference in a new issue