This is a note to let you know that I've just added the patch titled

    [media] media: Fix media device minor registration

to the 2.6.39-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     media-fix-media-device-minor-registration.patch
and it can be found in the queue-2.6.39 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 8c89ddd536bbe97c1e50424778a139abbf5763c3 Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <[email protected]>
Date: Mon, 30 May 2011 15:45:47 -0300
Subject: [media] media: Fix media device minor registration

From: Laurent Pinchart <[email protected]>

commit 8c89ddd536bbe97c1e50424778a139abbf5763c3 upstream.

The find_next_zero_bit() is called with the from and to arguments in the
wrong order. This results in the function always returning 0, and all
media devices being registered with minor 0. Furthermore, mdev->minor is
then used before being assigned with the find_next_zero_bit() return
value. This really makes sure we'll always use minor 0.

Fix this and let the system support more than one media device.

Signed-off-by: Laurent Pinchart <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/media/media-devnode.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -213,14 +213,14 @@ int __must_check media_devnode_register(
 
        /* Part 1: Find a free minor number */
        mutex_lock(&media_devnode_lock);
-       minor = find_next_zero_bit(media_devnode_nums, 0, MEDIA_NUM_DEVICES);
+       minor = find_next_zero_bit(media_devnode_nums, MEDIA_NUM_DEVICES, 0);
        if (minor == MEDIA_NUM_DEVICES) {
                mutex_unlock(&media_devnode_lock);
                printk(KERN_ERR "could not get a free minor\n");
                return -ENFILE;
        }
 
-       set_bit(mdev->minor, media_devnode_nums);
+       set_bit(minor, media_devnode_nums);
        mutex_unlock(&media_devnode_lock);
 
        mdev->minor = minor;


Patches currently in stable-queue which might be from 
[email protected] are

queue-2.6.39/media-fix-media-device-minor-registration.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to