Skip to content

Commit 0b045bd

Browse files
tititiou36axboe
authored andcommitted
mm/backing-dev.c: fix an error handling path in 'cgwb_create()'
If the 'kmalloc' fails, we must go through the existing error handling path. Signed-off-by: Christophe JAILLET <[email protected]> Fixes: 52ebea7 ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks") Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 09c2c35 commit 0b045bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mm/backing-dev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,10 @@ static int cgwb_create(struct backing_dev_info *bdi,
569569

570570
/* need to create a new one */
571571
wb = kmalloc(sizeof(*wb), gfp);
572-
if (!wb)
573-
return -ENOMEM;
572+
if (!wb) {
573+
ret = -ENOMEM;
574+
goto out_put;
575+
}
574576

575577
ret = wb_init(wb, bdi, blkcg_css->id, gfp);
576578
if (ret)

0 commit comments

Comments
 (0)