Hi,

there's a bad one in usb-skeleton.c. It assumes that release is
called on every close. That's not the case and decrementing a
counter in release is a bad bug.
No wonder we get buggy drivers.

This is against 2.5BK. Greg, please apply.

        Regards
                Oliver

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[EMAIL PROTECTED], 2002-10-22 23:01:59+02:00, [EMAIL PROTECTED]
  - release does not map to close




diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
--- a/drivers/usb/usb-skeleton.c        Tue Oct 22 23:02:34 2002
+++ b/drivers/usb/usb-skeleton.c        Tue Oct 22 23:02:34 2002
@@ -182,7 +182,7 @@
        .ioctl =        skel_ioctl,
        .open =         skel_open,
        .release =      skel_release,
-};      
+};
 
 
 /* usb specific object needed to register this driver with the usb subsystem */
@@ -203,8 +203,8 @@
 
        if (!debug)
                return;
-       
-       printk (KERN_DEBUG __FILE__": %s - length = %d, data = ", 
+
+       printk (KERN_DEBUG __FILE__": %s - length = %d, data = ",
                function, size);
        for (i = 0; i < size; ++i) {
                printk ("%.2x ", data[i]);
@@ -237,7 +237,7 @@
        struct usb_skel *dev = NULL;
        int subminor;
        int retval = 0;
-       
+
        dbg(__FUNCTION__);
 
        subminor = MINOR (inode->i_rdev) - USB_SKEL_MINOR_BASE;
@@ -318,13 +318,12 @@
                return 0;
        }
 
-       /* decrement our usage count for the device */
-       --dev->open_count;
-       if (dev->open_count <= 0) {
-               /* shutdown any bulk writes that might be going on */
-               usb_unlink_urb (dev->write_urb);
-               dev->open_count = 0;
-       }
+       /* shutdown any bulk writes that might be going on */
+       /* bulk reads cannot be active, because we have mutual
+       exclusion with read due to the device semaphore */
+       usb_unlink_urb (dev->write_urb);
+       dev->open_count = 0;
+
 
        /* decrement our usage count for the module */
        MOD_DEC_USE_COUNT;

===================================================================


This BitKeeper patch contains the following changesets:
1.944
## Wrapped with gzip_uu ##


begin 664 bkpatch2735
M'XL(`.J\M3T``ZU4:X_3.A#]7/^*$0B)Q[;UHV[:KHH6Z`(KT&6U:+\A5:XS
M)%%3>V4[6Y!R__N=I*+H2LLB'E$4.YZ'SYPY]D.XCA@6`U]7MQC80WCK8Z)?
M=-[AJ/0[K"O7?!GY4)#QRGLRCKOE\2%BO-D.4T",XR9NAG*D&;E=FF1+(&M<
M#,1('5?2UQM<#*[.WUR_?W'%V'()KTKC"OR("99+MMF>Y0W6HVWPINQV;(_F
M5G(NA)":*ST5NI4SI2:MF/)-3M-<9O//F^F<'3"=W87^_[FDX%**.>=:MWK&
MYY*M0(SFDPEP.19\+"5(M>!BH>?/N%QP#O>DAF<"AIR]A#\OX!6S,(2`-9J(
MD'N,X'R"G;F!Y,'6/B)[!WH^R32[_,X>&_[BPQ@WG#V_`W$>NCK[=O8MC5L"
MD[P;V>\E3(@PWJI)-M6MFFD^55DVRP3/<ZWO(^HGR?NFT$?H>:N45J*7R(]C
M[M;,GQ;`BH#%V2&?];N?8^:9Y'*J5*NDFAV$)-5OZHC#4(B_J*0]PJZ)J1=1
MCC;@+H&!)IH"P?K&)0Q0N6^".X$-6M.0QBQ`%UN:6Z18"B`&H/I\5&9H7"0A
M'KKT`89AW[\DK,M[&O8;,EV)F0;!+@[#OZ=L)?D4)+N0/*/A$QO<A,JE+3Q^
M=W[USWIU_O+Z#:S7KR_>GZ_7#Q;P*!(+-;HBE;"$1_D)Y"89FCXXH503WN4^
M#)_82DD!&;M0,H,I&XR?0BR;E/N]`^.^PJ:IM[`/5:)#F4I#I[(JRD240>$K
M5X!W\'3<A_6>`4T>P1K7<4].QB;BY4CQD=Y=DQI3LP%^L743*\JRKPAL%PZD
M@>[<IY+N`KRM+$)$N@M*'[#?B^A=-XX$M%TW80./R6GXO(?8_3\Y98-^Q=^@
A6_?MIL+Y*95ZO))MB78;F]W2:IL;U)+]!_DI.5D2!@``
`
end



-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future
of Java(TM) technology. Join the Java Community
Process(SM) (JCP(SM)) program now.
http://ad.doubleclick.net/clk;4699841;7576301;v?http://www.sun.com/javavote
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to