From: Dan Carpenter <dan.carpenter@oracle.com>
To: Chuhong Yuan <hslester96@gmail.com>
Cc: devel@driverdev.osuosl.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Tretter <m.tretter@pengutronix.de>,
linux-kernel@vger.kernel.org,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH] media: allegro: add the missed check for v4l2_m2m_ctx_init
Date: Mon, 9 Dec 2019 21:54:11 +0300 [thread overview]
Message-ID: <20191209185411.GK1765@kadam> (raw)
In-Reply-To: <20191209085807.16126-1-hslester96@gmail.com>
On Mon, Dec 09, 2019 at 04:58:07PM +0800, Chuhong Yuan wrote:
> diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c
> index 6f0cd0784786..5f1d454b41bb 100644
> --- a/drivers/staging/media/allegro-dvt/allegro-core.c
> +++ b/drivers/staging/media/allegro-dvt/allegro-core.c
> @@ -2341,6 +2341,13 @@ static int allegro_open(struct file *file)
> channel->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, channel,
> allegro_queue_init);
>
> + if (IS_ERR(channel->fh.m2m_ctx)) {
> + v4l2_fh_del(&channel->fh);
> + v4l2_fh_exit(&channel->fh);
> + kfree(channel);
^^^^^^^
Free
> + return PTR_ERR(channel->fh.m2m_ctx);
^^^^^^^^^^^^^^^^^^^
Dereferencing freed memory.
regards,
dan carpenter
> + }
> +
prev parent reply other threads:[~2019-12-09 18:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 8:58 [PATCH] media: allegro: add the missed check for v4l2_m2m_ctx_init Chuhong Yuan
2019-12-09 15:22 ` Michael Tretter
2019-12-09 18:54 ` Dan Carpenter [this message]
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=20191209185411.GK1765@kadam \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hslester96@gmail.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.tretter@pengutronix.de \
--cc=mchehab+samsung@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