Re: [PATCH 4.4 20/41] bsg-lib: dont free job in bsg_prepare_job

From: Ben Hutchings
Date: Mon Oct 16 2017 - 12:32:35 EST


On Tue, 2017-10-03 at 14:21 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.ÂÂIf anyone has any objections, please let me know.
>
> ------------------
>
> From: Christoph Hellwig <hch@xxxxxx>
>
> commit f507b54dccfd8000c517d740bc45f20c74532d18 upstream.
>
> The job structure is allocated as part of the request, so we should not
> free it in the error path of bsg_prepare_job.

That function doesn't exist here (it was introduced in 4.13). Instead,
this backport has modified bsg_create_job(), creating a leak. Please
revert this on the 3.18, 4.4 and 4.9 stable branches.

Ben.

> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>
> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> ---
> Âblock/bsg-lib.c |ÂÂÂÂ1 -
> Â1 file changed, 1 deletion(-)
>
> --- a/block/bsg-lib.c
> +++ b/block/bsg-lib.c
> @@ -147,7 +147,6 @@ static int bsg_create_job(struct device
> Âfailjob_rls_rqst_payload:
> Â kfree(job->request_payload.sg_list);
> Âfailjob_rls_job:
> - kfree(job);
> Â return -ENOMEM;
> Â}
> Â
>
>
>
--
Ben Hutchings
Software Developer, Codethink Ltd.