extending BKL in v4l open

From: Oliver Neukum (Oliver.Neukum@lrz.uni-muenchen.de)
Date: Wed Aug 22 2001 - 10:13:43 EST


Hi,

I'd like to propose an extension of code under the BKL in v4l's open method
to include the actual open of the low level v4l driver. Otherwise there's a
race with usb v4l drivers which deregister themselves as v4l devices upon
being disconnected on usb, as the pointer passed may point to freed memory.

        Regards
                Oliver

--- videodev.c.alt Sun Aug 12 19:38:48 2001
+++ videodev.c Wed Aug 22 17:07:51 2001
@@ -164,8 +164,7 @@

         if(vfl->owner)
                 __MOD_INC_USE_COUNT(vfl->owner);
- unlock_kernel();
-
+
         if(vfl->open)
         {
                 err=vfl->open(vfl,0); /* Tell the device it is open */
@@ -174,10 +173,12 @@
                         vfl->busy=0;
                         if(vfl->owner)
                                 __MOD_DEC_USE_COUNT(vfl->owner);
-
+
+ unlock_kernel();
                         return err;
                 }
         }
+ unlock_kernel();
         return 0;
 error_out:
         unlock_kernel();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 23 2001 - 21:00:49 EST