mm/backing-dev.c: fix an error handling path in 'cgwb_create()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 11 Sep 2017 19:43:23 +0000 (21:43 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Sep 2017 20:16:44 +0000 (14:16 -0600)
If the 'kmalloc' fails, we must go through the existing error handling
path.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Fixes: 52ebea749aae ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
mm/backing-dev.c

index f028a9a472fd9b2c7098bce8fe622fd58ba2f140..e19606bb41a0b5b48f6cbca8268eb529718da45c 100644 (file)
@@ -569,8 +569,10 @@ static int cgwb_create(struct backing_dev_info *bdi,
 
        /* need to create a new one */
        wb = kmalloc(sizeof(*wb), gfp);
-       if (!wb)
-               return -ENOMEM;
+       if (!wb) {
+               ret = -ENOMEM;
+               goto out_put;
+       }
 
        ret = wb_init(wb, bdi, blkcg_css->id, gfp);
        if (ret)