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]
Message-ID: <YEjBc0rdAoaw+8lo@pendragon.ideasonboard.com>
Date:   Wed, 10 Mar 2021 14:54:11 +0200
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     "Lad, Prabhakar" <prabhakar.csengg@...il.com>
Cc:     Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
        Dave Stevenson <dave.stevenson@...pberrypi.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Pavel Machek <pavel@...x.de>,
        Andrey Konovalov <andrey.konovalov@...aro.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Jacopo Mondi <jacopo@...ndi.org>,
        Hans Verkuil <hverkuil-cisco@...all.nl>,
        linux-media <linux-media@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Biju Das <biju.das.jz@...renesas.com>
Subject: Re: [PATCH 2/3] media: i2c: imx219: Serialize during stream
 start/stop

Hi Prabhakar,

On Wed, Mar 10, 2021 at 12:46:39PM +0000, Lad, Prabhakar wrote:
> On Wed, Mar 10, 2021 at 12:40 PM Laurent Pinchart wrote:
> > On Wed, Mar 10, 2021 at 12:20:13PM +0000, Lad Prabhakar wrote:
> > > Serialize during stream start/stop in suspend/resume callbacks.
> >
> > Could you please explain why this is needed ?
> >
> The streaming variable in this driver has serialized access, but this
> wasn't taken care during suspend/resume callbacks.

But nothing that touches the streaming variable can run concurrently to
suspend/resume, isn't it ?

I'm actually even quite dubious about the need to start and stop
streaming during resume and suspend, the driver using the subdev should
start/stop the whole video pipeline at suspend/resume time.

> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
> > > ---
> > >  drivers/media/i2c/imx219.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> > > index f0cf1985a4dc..87c021de1460 100644
> > > --- a/drivers/media/i2c/imx219.c
> > > +++ b/drivers/media/i2c/imx219.c
> > > @@ -1172,8 +1172,10 @@ static int __maybe_unused imx219_suspend(struct device *dev)
> > >       struct v4l2_subdev *sd = dev_get_drvdata(dev);
> > >       struct imx219 *imx219 = to_imx219(sd);
> > >
> > > +     mutex_lock(&imx219->mutex);
> > >       if (imx219->streaming)
> > >               imx219_stop_streaming(imx219);
> > > +     mutex_unlock(&imx219->mutex);
> > >
> > >       return 0;
> > >  }
> > > @@ -1184,11 +1186,13 @@ static int __maybe_unused imx219_resume(struct device *dev)
> > >       struct imx219 *imx219 = to_imx219(sd);
> > >       int ret;
> > >
> > > +     mutex_lock(&imx219->mutex);
> > >       if (imx219->streaming) {
> > >               ret = imx219_start_streaming(imx219);
> > >               if (ret)
> > >                       goto error;
> > >       }
> > > +     mutex_unlock(&imx219->mutex);
> > >
> > >       return 0;
> > >
> > > @@ -1197,6 +1201,7 @@ static int __maybe_unused imx219_resume(struct device *dev)
> > >       imx219->streaming = false;
> > >       __v4l2_ctrl_grab(imx219->vflip, false);
> > >       __v4l2_ctrl_grab(imx219->hflip, false);
> > > +     mutex_unlock(&imx219->mutex);
> > >
> > >       return ret;
> > >  }

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ