2017-09-11 19:46:29

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] 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]>
---
mm/backing-dev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index f028a9a472fd..e19606bb41a0 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -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)
--
2.11.0


2017-09-11 19:53:03

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'

On 09/11/2017 01:43 PM, Christophe JAILLET wrote:
> If the 'kmalloc' fails, we must go through the existing error handling
> path.

Looks good to me, probably wants a

Fixes: 52ebea749aae ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")

line as well.

--
Jens Axboe

2017-09-11 20:04:46

by Christophe JAILLET

[permalink] [raw]
Subject: Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'

Le 11/09/2017 à 21:52, Jens Axboe a écrit :
> On 09/11/2017 01:43 PM, Christophe JAILLET wrote:
>> If the 'kmalloc' fails, we must go through the existing error handling
>> path.
> Looks good to me, probably wants a
>
> Fixes: 52ebea749aae ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
>
> line as well.
>
Hi,

do you want me to resend with the Fixes tag? Or will it be added if merged?

CJ

2017-09-11 20:07:32

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'

On 09/11/2017 02:04 PM, Christophe JAILLET wrote:
> Le 11/09/2017 à 21:52, Jens Axboe a écrit :
>> On 09/11/2017 01:43 PM, Christophe JAILLET wrote:
>>> If the 'kmalloc' fails, we must go through the existing error handling
>>> path.
>> Looks good to me, probably wants a
>>
>> Fixes: 52ebea749aae ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
>>
>> line as well.
>>
> Hi,
>
> do you want me to resend with the Fixes tag? Or will it be added if merged?

Shouldn't be necessary to resend. Not sure who will queue it up, mm/ always
ends up being somewhat of a no-mans-land :-)

--
Jens Axboe

2017-09-11 20:15:11

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'

On Mon 11-09-17 21:43:23, Christophe JAILLET wrote:
> If the 'kmalloc' fails, we must go through the existing error handling
> path.
>
> Signed-off-by: Christophe JAILLET <[email protected]>

Looks good to me. You can add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> mm/backing-dev.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/backing-dev.c b/mm/backing-dev.c
> index f028a9a472fd..e19606bb41a0 100644
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -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)
> --
> 2.11.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2017-09-11 20:17:26

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'

On 09/11/2017 02:15 PM, Jan Kara wrote:
> On Mon 11-09-17 21:43:23, Christophe JAILLET wrote:
>> If the 'kmalloc' fails, we must go through the existing error handling
>> path.
>>
>> Signed-off-by: Christophe JAILLET <[email protected]>
>
> Looks good to me. You can add:
>
> Reviewed-by: Jan Kara <[email protected]>

I'll queue it up, with your reviewed-by added. Thanks.

--
Jens Axboe