Hi,

this fixes the read method by use of a temporary buffer.
This needs testing.

        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], 2003-01-10 20:10:21+01:00, [EMAIL PROTECTED]
   - fix user space access with spinlock held


 usb-midi.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)


diff -Nru a/drivers/usb/class/usb-midi.c b/drivers/usb/class/usb-midi.c
--- a/drivers/usb/class/usb-midi.c      Fri Jan 10 20:10:40 2003
+++ b/drivers/usb/class/usb-midi.c      Fri Jan 10 20:10:40 2003
@@ -691,18 +691,26 @@
 
                {
                        int i;
-                       unsigned long flags; /* used to synchronize access to the 
endpoint */
-                       spin_lock_irqsave( &ep->lock, flags );
+                       char *tb;
+                       
+                       tb = kmalloc(cnt, GFP_KERNEL);
+                       if (!tb) {
+                               ret = -ENOMEM;
+                               break;
+                       }
+                       spin_lock_irq( &ep->lock );
                        for (i = 0; i < cnt; i++) {
-                               if ( copy_to_user( buffer+i, 
m->min.buf+m->min.bufRdPtr, 1 ) ) {
-                                       if ( !ret )
-                                               ret = -EFAULT;
-                                       break;
-                               }
+                               tb[i] = m->min.buf+m->min.bufRdPtr;
                                m->min.bufRdPtr = (m->min.bufRdPtr+1)%MIDI_IN_BUFSIZ;
                                m->min.bufRemains -= 1;
                        }
-                       spin_unlock_irqrestore( &ep->lock, flags );
+                       spin_unlock_irq( &ep->lock );
+                       if (__copy_to_user(buffer, tb, cnt)) {
+                               ret = -EFAULT;
+                               kfree(tb);
+                               break;
+                       }
+                       kfree(tb);
                }
 
                count-=cnt;

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


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


begin 664 bkpatch2995
M'XL(`+`:'SX``ZU4:V^;,!3]C'_%G2I-Z5K`YADRI6K7IEW55Y2MGZ8)86,"
M@D!J8&TU]M]GDRG=IBY;NR(>MN^]Q_=PCKP%US47(ZTJLB]<H"UX7]6-G/*R
M*KF15@M>9&5[9U1B+H.SJI)!4RV;JPJ3YGHC.*_-119GEHMDUC1J6`HR6(\T
M8MCKE>9^R4?:;')R?7XP0V@\AL,T*N?\`V]@/$8TWX];7ABYJ*)4;=BMPYV%
M,2'$<K'M>L3MK*%M.QWQ,(WE,+;\(*%>@%8M[3_6_*]8MD3#1(+@H+,=XCGH
M"(A!+,<!;)N8F`2#A4<$CRRR@\D(8]B`#3L$=(S>P?\S.$0,0(<DNX-6Z@+U
M,F(<(L9X7<-MUJ1R)2N+BN60\B)&9Z#:M]'TX5<B_8D70CC":`_F@L_W5ZVS
M:M'%0A&NS;:F)BNBNA_I2F6#*386]G"`/==VAQVQ78P[SW)LWZ9VXE,<<)=O
M^F=_A5])%!!LD8ZXCD-ZPVRJ4AYZ<0X;/?5O'(:VE%Y*;1&_MYE%GFDR#_3A
MB[GL229;"7`%NKCM;VF:Z48MGF'"(R]PP$*G7N#"$&F:QM)(P)N&OE43]304
MQI`OHD*V-F!ELPLGQ]/P;#*[G)QO]UE9`H-7#=V&KVJF"76P@#ZYO+J87/0)
M&A4\ROOA-_521$/%-,S$S0!>\Z6^UQ.7>+(A'UQTZF,"I"]NZ*?LLT1<Z'N+
MK#1HF^P\#&?QM!&RRL>N3#]5'W^]15O^89,?38<AJY;W85.%2I&!A$NXV(6&
M[H(DNOT[H>.#Z_./*T)Y(D_?@>3\*+^?HNMCF*6<Y76[&`?<B0.**?H.AVG\
%B04&````
`
end



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to