From: Greg KH <gregkh@linuxfoundation.org>
To: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: stable@vger.kernel.org, bparrot@ti.com, mchehab@kernel.org,
sashal@kernel.org, laurent.pinchart@ideasonboard.com,
patches@lists.linux.dev
Subject: Re: [PATCH 5.10] media: ti: cal: revert "media: ti: cal: fix possible memory leak in cal_ctx_create()"
Date: Mon, 3 Apr 2023 14:53:17 +0200 [thread overview]
Message-ID: <2023040303-corporate-unearth-8b5b@gregkh> (raw)
In-Reply-To: <20230403121704.3017781-1-cuigaosheng1@huawei.com>
On Mon, Apr 03, 2023 at 08:17:04PM +0800, Gaosheng Cui wrote:
> This reverts commit c7a218cbf67fffcd99b76ae3b5e9c2e8bef17c8c.
>
> The memory of ctx is allocated by devm_kzalloc in cal_ctx_create,
> it should not be freed by kfree when cal_ctx_v4l2_init() fails,
> otherwise kfree() will cause double free, so revert this patch.
>
> Fixes: c7a218cbf67f ("media: ti: cal: fix possible memory leak in cal_ctx_create()")
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
> drivers/media/platform/ti-vpe/cal.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
> index 93121c90d76a..2eef245c31a1 100644
> --- a/drivers/media/platform/ti-vpe/cal.c
> +++ b/drivers/media/platform/ti-vpe/cal.c
> @@ -624,10 +624,8 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst)
> ctx->cport = inst;
>
> ret = cal_ctx_v4l2_init(ctx);
> - if (ret) {
> - kfree(ctx);
> + if (ret)
> return NULL;
> - }
>
> return ctx;
> }
> --
> 2.25.1
>
Why is this not needed to be reverted in Linus's tree first?
thanks,
greg k-h
next prev parent reply other threads:[~2023-04-03 12:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 12:17 [PATCH 5.10] media: ti: cal: revert "media: ti: cal: fix possible memory leak in cal_ctx_create()" Gaosheng Cui
2023-04-03 12:53 ` Greg KH [this message]
[not found] ` <beac5f8a-d96e-1e1f-1e3c-18f3f9d7519c@huawei.com>
2023-04-03 13:35 ` Greg KH
2023-04-04 1:35 ` cuigaosheng
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=2023040303-corporate-unearth-8b5b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=bparrot@ti.com \
--cc=cuigaosheng1@huawei.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=mchehab@kernel.org \
--cc=patches@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.