From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] v4l: rcar-vin: Implement V4L2 video node release handler
Date: Mon, 4 Dec 2017 14:34:10 +0100 [thread overview]
Message-ID: <20171204133410.GA31989@bigcity.dyn.berto.se> (raw)
In-Reply-To: <1fa05d50-b45e-126c-4401-7bfb00b99170@xs4all.nl>
Hi Hans,
On 2017-12-04 10:05:35 +0100, Hans Verkuil wrote:
> Hi Niklas,
>
> On 11/16/2017 01:27 AM, Laurent Pinchart wrote:
> > Hi Niklas,
> >
> > On Thursday, 16 November 2017 01:34:33 EET Niklas Söderlund wrote:
> >> On 2017-11-16 00:49:07 +0200, Laurent Pinchart wrote:
> >>> The rvin_dev data structure contains driver private data for an instance
> >>> of the VIN. It is allocated dynamically at probe time, and must be freed
> >>> once all users are gone.
> >>>
> >>> The structure is currently allocated with devm_kzalloc(), which results
> >>> in memory being freed when the device is unbound. If a userspace
> >>> application is currently performing an ioctl call, or just keeps the
> >>> device node open and closes it later, this will lead to accessing freed
> >>> memory.
> >>>
> >>> Fix the problem by implementing a V4L2 release handler for the video
> >>> node associated with the VIN instance (called when the last user of the
> >>> video node releases it), and freeing memory explicitly from the release
> >>> handler.
> >>>
> >>> Signed-off-by: Laurent Pinchart
> >>> <laurent.pinchart+renesas@ideasonboard.com>
> >>
> >> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> >>
> >> This patch is based on-top of the VIN Gen3 enablement series not yet
> >> upstream. This is OK for me, just wanted to check that this was the
> >> intention as to minimize conflicts between the two.
> >
> > Yes, that's my intention. The patch should be included, or possibly squashed
> > in, your development branch.
> >
>
> Has this patch been added in your v8 series? If not, can you add it when you
> post a v9?
This patch needs more work, with the video device now registered at
complete() time and unregistered at unbind() time. Applying this would
free the rcar-vin private data structure at unbind() which probably not
what we want.
I think this issue should be addressed but maybe together with a
patch-set targeting the generic problem with video device lifetimes in
v4l2 framework? For now I would be happy to focus on getting Gen3
support picked-up and observe what Laurent's work on lifetime issues
brings and adept the rcar-vin driver to take advantage of that once it's
ready.
>
> Thanks,
>
> Hans
--
Regards,
Niklas Söderlund
next prev parent reply other threads:[~2017-12-04 13:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 22:49 [PATCH] v4l: rcar-vin: Implement V4L2 video node release handler Laurent Pinchart
2017-11-15 23:34 ` Niklas Söderlund
2017-11-16 0:27 ` Laurent Pinchart
2017-12-04 9:05 ` Hans Verkuil
2017-12-04 13:34 ` Niklas Söderlund [this message]
2017-12-04 13:41 ` Hans Verkuil
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=20171204133410.GA31989@bigcity.dyn.berto.se \
--to=niklas.soderlund@ragnatech.se \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@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