public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Shuah Khan <shuahkh@osg.samsung.com>
Subject: Re: [PATCH 2/2] [media] avoid double locks with graph_mutex
Date: Tue, 29 Mar 2016 06:28:27 -0300	[thread overview]
Message-ID: <20160329062827.581a67d1@recife.lan> (raw)
In-Reply-To: <20160329061734.1a1a5291@recife.lan>

Em Tue, 29 Mar 2016 06:17:34 -0300
Mauro Carvalho Chehab <mchehab@osg.samsung.com> escreveu:

> > > diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> > > index 6cfa890af7b4..6af5e6932271 100644
> > > --- a/drivers/media/media-device.c
> > > +++ b/drivers/media/media-device.c
> > > @@ -93,7 +93,6 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id)
> > >  	media_device_for_each_entity(entity, mdev) {
> > >  		if (((media_entity_id(entity) == id) && !next) ||
> > >  		    ((media_entity_id(entity) > id) && next)) {
> > > -			mutex_unlock(&mdev->graph_mutex);    
> > 
> > Unrelated to this patch.  
> 
> Yes. This belongs to patch 1.
> 
> > 
> > Please do also consider compat IOCTL handling code.
> >   

Sorry, I forgot to mention this one on my previous email.

Compat32 handling is just:

        switch (cmd) {
       	case MEDIA_IOC_ENUM_LINKS32:
               	mutex_lock(&dev->graph_mutex);
                ret = media_device_enum_links32(dev,
                                (struct media_links_enum32 __user *)arg);
               	mutex_unlock(&dev->graph_mutex);
                break;

        default:
                return media_device_ioctl(filp, cmd, arg);
        }

and media_device_enum_links32() doesn't call an function with a
mutex. So, it is safe.

Thanks,
Mauro

  reply	other threads:[~2016-03-29  9:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 22:22 [PATCH 0/2] media: Revert broken locking changes Laurent Pinchart
2016-03-24 22:22 ` [PATCH 1/2] Revert "[media] media-device: use kref for media_device instance" Laurent Pinchart
2016-03-24 22:22 ` [PATCH 2/2] Revert "[media] media-device: get rid of the spinlock" Laurent Pinchart
2016-03-28 18:09 ` [PATCH 0/2] media: Revert broken locking changes Mauro Carvalho Chehab
2016-03-28 18:11   ` [PATCH 1/2] [media] media-device: Fix mutex handling code for ioctl Mauro Carvalho Chehab
2016-03-28 18:11     ` [PATCH 2/2] [media] avoid double locks with graph_mutex Mauro Carvalho Chehab
2016-03-28 19:38       ` Javier Martinez Canillas
2016-03-28 22:06       ` Sakari Ailus
2016-03-29  9:17         ` Mauro Carvalho Chehab
2016-03-29  9:28           ` Mauro Carvalho Chehab [this message]
2016-03-29  9:38             ` Sakari Ailus
2016-03-28 21:58     ` [PATCH 1/2] [media] media-device: Fix mutex handling code for ioctl Sakari Ailus
2016-03-29  9:07       ` Mauro Carvalho Chehab
2016-03-28 19:28   ` [PATCH 0/2] media: Revert broken locking changes Javier Martinez Canillas
2016-03-28 19:29   ` Laurent Pinchart
2016-03-28 20:15     ` Mauro Carvalho Chehab

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=20160329062827.581a67d1@recife.lan \
    --to=mchehab@infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=shuahkh@osg.samsung.com \
    /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