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: <201010182139.54502.hverkuil@xs4all.nl>
Date:	Mon, 18 Oct 2010 21:39:54 +0200
From:	Hans Verkuil <hverkuil@...all.nl>
To:	Mauro Carvalho Chehab <mchehab@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, Valdis.Kletnieks@...edu,
	linux-kernel@...r.kernel.org, linux-media@...r.kernel.org
Subject: Re: mmotm 2010-10-13 - GSPCA SPCA561 webcam driver broken

On Monday, October 18, 2010 21:00:57 Mauro Carvalho Chehab wrote:
> Em 15-10-2010 09:23, Hans Verkuil escreveu:
> > On Friday, October 15, 2010 14:05:39 Mauro Carvalho Chehab wrote:
> >> Em 15-10-2010 07:02, Hans Verkuil escreveu:
> >>> On Friday, October 15, 2010 11:05:26 Andrew Morton wrote:
> >>>> On Fri, 15 Oct 2010 10:45:45 +0200 Hans Verkuil <hverkuil@...all.nl> wrote:
> >>>>
> >>>>> On Thursday, October 14, 2010 22:06:29 Valdis.Kletnieks@...edu wrote:
> >>>>>> On Wed, 13 Oct 2010 17:13:25 PDT, akpm@...ux-foundation.org said:
> >>>>>>> The mm-of-the-moment snapshot 2010-10-13-17-13 has been uploaded to
> >>>
> >>> Mauro, is this something for you to fix?
> >>
> >> I have a patch fixing this conflict already:
> >>
> >> http://git.linuxtv.org/mchehab/sbtvd.git?a=commit;h=88164fbe701a0a16e9044b74443dddb6188b54cc
> >>
> >> The patch is currently on a separate tree, that I'm using to test some experimental
> >> drivers for Brazilian Digital TV system (SBTVD). I'm planning to merge this patch, among
> >> with other patches I received for .37 during this weekend.
> > 
> > No, this patch isn't sufficient. It backs out the wrong code but doesn't put
> > in the 'video_is_registered()' if statements that were in my original patch.
> > 
> > Those are really needed.
> 
> Ok, I've re-done the conflict fix patch:
> 
> http://git.kernel.org/?p=linux/kernel/git/mchehab/linux-next.git;a=commitdiff;h=f9fccbad2a67668240edeaa6ada5aea2281d10b3

I hate to say this, but it is still not right. This is the correct code:

static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
        struct video_device *vdev = video_devdata(filp);
        int ret = -ENODEV;

        if (vdev->fops->unlocked_ioctl) {
                if (vdev->lock)
                        mutex_lock(vdev->lock);
                if (video_is_registered(vdev))
                        ret = vdev->fops->unlocked_ioctl(filp, cmd, arg);
                if (vdev->lock)
                        mutex_unlock(vdev->lock);
        } else if (vdev->fops->ioctl) {
                /* TODO: convert all drivers to unlocked_ioctl */
                lock_kernel();
                if (video_is_registered(vdev))
                        ret = vdev->fops->ioctl(filp, cmd, arg);
                unlock_kernel();
        } else
                ret = -ENOTTY;

        return ret;
}

As you can see, the video_is_registered is called with the lock held.

Regards,

	Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ