dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Iago Toral <itoral@igalia.com>
To: Sasha Levin <sashal@kernel.org>,
	linux-kernel@vger.kernel.org,  stable@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH AUTOSEL 5.4 003/205] drm/v3d: don't leak bin job if v3d_job_init fails.
Date: Fri, 17 Jan 2020 08:25:30 +0100	[thread overview]
Message-ID: <cb93a21557216d1b389390c556f421132aac88f0.camel@igalia.com> (raw)
In-Reply-To: <20200116164300.6705-3-sashal@kernel.org>

Hi Sasha,


please notice that there were two separate patches that addressed the
same issue and applying both simultaneously leads to a double free
(which is what I see is happening with this patch: see the second call
to kfree(bin) right below the one added here). This issue was raised
previously here:

https://lists.freedesktop.org/archives/dri-devel/2019-October/241425.html

Iago

On Thu, 2020-01-16 at 11:39 -0500, Sasha Levin wrote:
> From: Iago Toral Quiroga <itoral@igalia.com>
> 
> [ Upstream commit 0d352a3a8a1f26168d09f7073e61bb4b328e3bb9 ]
> 
> If the initialization of the job fails we need to kfree() it
> before returning.
> 
> Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> Link: 
> https://patchwork.freedesktop.org/patch/msgid/20190916071125.5255-1-itoral@igalia.com
> Fixes: a783a09ee76d ("drm/v3d: Refactor job management.")
> Reviewed-by: Eric Anholt <eric@anholt.net>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  drivers/gpu/drm/v3d/v3d_gem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c
> b/drivers/gpu/drm/v3d/v3d_gem.c
> index 19c092d75266..6316bf3646af 100644
> --- a/drivers/gpu/drm/v3d/v3d_gem.c
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -565,6 +565,7 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void
> *data,
>  		ret = v3d_job_init(v3d, file_priv, &bin->base,
>  				   v3d_job_free, args->in_sync_bcl);
>  		if (ret) {
> +			kfree(bin);
>  			v3d_job_put(&render->base);
>  			kfree(bin);
>  			return ret;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-01-17  7:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200116164300.6705-1-sashal@kernel.org>
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 002/205] drm/panfrost: Add missing check for pfdev->regulator Sasha Levin
2020-01-17 16:12   ` Steven Price
2020-01-17 16:59     ` Greg KH
2020-01-18  8:18       ` Dan Carpenter
2020-01-18 13:18         ` Greg KH
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 003/205] drm/v3d: don't leak bin job if v3d_job_init fails Sasha Levin
2020-01-17  7:25   ` Iago Toral [this message]
2020-01-23 14:17     ` Sasha Levin
2020-01-23 15:46       ` Iago Toral
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 004/205] drm: panel-lvds: Potential Oops in probe error handling Sasha Levin
2020-01-16 16:39 ` [PATCH AUTOSEL 5.4 019/205] drm/amdgpu: remove excess function parameter description Sasha Levin
2020-01-16 16:40 ` [PATCH AUTOSEL 5.4 035/205] drm/rockchip: Round up _before_ giving to the clock framework Sasha Levin
2020-01-16 16:40 ` [PATCH AUTOSEL 5.4 048/205] drm: rcar_lvds: Fix color mismatches on R-Car H2 ES2.0 and later Sasha Levin
2020-01-16 16:40 ` [PATCH AUTOSEL 5.4 058/205] xprtrdma: Connection becomes unstable after a reconnect Sasha Levin
2020-01-16 16:40 ` [PATCH AUTOSEL 5.4 059/205] xprtrdma: Fix MR list handling Sasha Levin
2020-01-16 16:40 ` [PATCH AUTOSEL 5.4 060/205] drm/tegra: Fix ordering of cleanup code Sasha Levin
2020-01-16 16:40 ` [PATCH AUTOSEL 5.4 066/205] drm/amdgpu/vi: silence an uninitialized variable warning Sasha Levin
2020-01-16 16:42 ` [PATCH AUTOSEL 5.4 169/205] drm/radeon: fix bad DMA from INTERRUPT_CNTL2 Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb93a21557216d1b389390c556f421132aac88f0.camel@igalia.com \
    --to=itoral@igalia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).