lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 16 Jun 2019 21:43:22 +0300
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Hans Verkuil <hverkuil-cisco@...all.nl>
Cc:     helen.koike@...labora.com, Shuah Khan <skhan@...uxfoundation.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/2] Use Media Dev Allocator to fix vimc dev lifetime bugs

Hi Hans,

On Thu, Jun 13, 2019 at 07:44:15AM +0200, Hans Verkuil wrote:
> On 5/24/19 5:31 AM, Shuah Khan wrote:
> > media_device is embedded in struct vimc_device and when vimc is removed
> > vimc_device and the embedded media_device goes with it, while the active
> > stream and vimc_capture continue to access it.
> > 
> > Fix the media_device lifetime problem by changing vimc to create shared
> > media_device using Media Device Allocator API and vimc_capture getting
> > a reference to vimc module. With this change, vimc module can be removed
> > only when the references are gone. vimc can be removed after vimc_capture
> > is removed.
> > 
> > Media Device Allocator API supports just USB devices. Enhance it
> > adding a genetic device allocate interface to support other media
> > drivers.
> > 
> > The new interface takes pointer to struct device instead and creates
> > media device. This interface allows a group of drivers that have a
> > common root device to share media device resource and ensure media
> > device doesn't get deleted as long as one of the drivers holds its
> > reference.
> > 
> > The new interface has been tested with vimc component driver to fix
> > panics when vimc module is removed while streaming is in progress.
> 
> Helen, can you review this series? I'm not sure this is the right approach
> for a driver like vimc, and even if it is, then it is odd that vimc-capture
> is the only vimc module that's handled here.
> 
> My gut feeling is that this should be handled inside vimc directly and not
> using the media-dev-allocator.

That's my opinion too, I don't see why the media dev allocator would be
needed here. We know how to fix this kind of issues, it requires proper
lifetime management of objects with refcouting, using the media dev
allocator is a hack that would just hide the problem deeper. Hiding
problems deeper during the last MC rework brought us where we are today,
and I don't think we should repeat the same mistake.

> > Shuah Khan (2):
> >   media: add generic device allocate interface to media-dev-allocator
> >   vimc: fix BUG: unable to handle kernel NULL pointer dereference
> > 
> >  drivers/media/Makefile                     |  4 +-
> >  drivers/media/media-dev-allocator.c        | 39 ++++++++++++++
> >  drivers/media/platform/vimc/vimc-capture.c | 17 +++++-
> >  drivers/media/platform/vimc/vimc-core.c    | 60 ++++++++++++----------
> >  include/media/media-dev-allocator.h        | 46 ++++++++++++++---
> >  5 files changed, 130 insertions(+), 36 deletions(-)

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ