All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] usbvision-video: two use after frees
Date: Thu, 16 Oct 2014 08:25:45 +0000	[thread overview]
Message-ID: <5545024.x6hpeqSvG5@avalon> (raw)
In-Reply-To: <543F8069.8020005@xs4all.nl>

On Thursday 16 October 2014 10:23:05 Hans Verkuil wrote:
> On 10/16/2014 10:09 AM, Laurent Pinchart wrote:
> > On Thursday 16 October 2014 10:57:21 Dan Carpenter wrote:
> >> The lock has been freed in usbvision_release() so there is no need to
> >> call mutex_unlock() here.
> > 
> > Yuck :-/
> > 
> > The driver should really be converted to use video_device::release. That
> > might be out of scope for this fix though. Is usbvision maintained ?
> 
> I have hardware, and at some point I plan to convert it to modern
> frameworks. But ENOTIME for now. So I guess I might be the closest to a
> being a maintainer.

Can you ack the patch then ? :-)

> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >> 
> >> diff --git a/drivers/media/usb/usbvision/usbvision-video.c
> >> b/drivers/media/usb/usbvision/usbvision-video.c index 68bc961..9bfa041
> >> 100644
> >> --- a/drivers/media/usb/usbvision/usbvision-video.c
> >> +++ b/drivers/media/usb/usbvision/usbvision-video.c
> >> @@ -446,6 +446,7 @@ static int usbvision_v4l2_close(struct file *file)
> >>  	if (usbvision->remove_pending) {
> >>  		printk(KERN_INFO "%s: Final disconnect\n", __func__);
> >>  		usbvision_release(usbvision);
> >> +		return 0;
> >>  	}
> >>  	mutex_unlock(&usbvision->v4l2_lock);
> >> 
> >> @@ -1221,6 +1222,7 @@ static int usbvision_radio_close(struct file *file)
> >>  	if (usbvision->remove_pending) {
> >>  		printk(KERN_INFO "%s: Final disconnect\n", __func__);
> >>  		usbvision_release(usbvision);
> >> +		return err_code;
> >>  	}
> >>  	
> >>  	mutex_unlock(&usbvision->v4l2_lock);

-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Mauro Carvalho Chehab <m.chehab@samsung.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] [media] usbvision-video: two use after frees
Date: Thu, 16 Oct 2014 11:25:45 +0300	[thread overview]
Message-ID: <5545024.x6hpeqSvG5@avalon> (raw)
In-Reply-To: <543F8069.8020005@xs4all.nl>

On Thursday 16 October 2014 10:23:05 Hans Verkuil wrote:
> On 10/16/2014 10:09 AM, Laurent Pinchart wrote:
> > On Thursday 16 October 2014 10:57:21 Dan Carpenter wrote:
> >> The lock has been freed in usbvision_release() so there is no need to
> >> call mutex_unlock() here.
> > 
> > Yuck :-/
> > 
> > The driver should really be converted to use video_device::release. That
> > might be out of scope for this fix though. Is usbvision maintained ?
> 
> I have hardware, and at some point I plan to convert it to modern
> frameworks. But ENOTIME for now. So I guess I might be the closest to a
> being a maintainer.

Can you ack the patch then ? :-)

> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >> 
> >> diff --git a/drivers/media/usb/usbvision/usbvision-video.c
> >> b/drivers/media/usb/usbvision/usbvision-video.c index 68bc961..9bfa041
> >> 100644
> >> --- a/drivers/media/usb/usbvision/usbvision-video.c
> >> +++ b/drivers/media/usb/usbvision/usbvision-video.c
> >> @@ -446,6 +446,7 @@ static int usbvision_v4l2_close(struct file *file)
> >>  	if (usbvision->remove_pending) {
> >>  		printk(KERN_INFO "%s: Final disconnect\n", __func__);
> >>  		usbvision_release(usbvision);
> >> +		return 0;
> >>  	}
> >>  	mutex_unlock(&usbvision->v4l2_lock);
> >> 
> >> @@ -1221,6 +1222,7 @@ static int usbvision_radio_close(struct file *file)
> >>  	if (usbvision->remove_pending) {
> >>  		printk(KERN_INFO "%s: Final disconnect\n", __func__);
> >>  		usbvision_release(usbvision);
> >> +		return err_code;
> >>  	}
> >>  	
> >>  	mutex_unlock(&usbvision->v4l2_lock);

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2014-10-16  8:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16  7:57 [patch] [media] usbvision-video: two use after frees Dan Carpenter
2014-10-16  7:57 ` Dan Carpenter
2014-10-16  8:09 ` Laurent Pinchart
2014-10-16  8:09   ` Laurent Pinchart
2014-10-16  8:23   ` Hans Verkuil
2014-10-16  8:23     ` Hans Verkuil
2014-10-16  8:25     ` Laurent Pinchart [this message]
2014-10-16  8:25       ` Laurent Pinchart

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=5545024.x6hpeqSvG5@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dan.carpenter@oracle.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=sakari.ailus@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.