Hi,

as promised, here is a new version of the 2.4 storage deadlock fix.
It does a few things.

1. usb_get_configuration() is used in the reset path
2. in the synchronous API the task state is set to early, as memory
allocations in usb_submit_urb() can change it.

Comments?

        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], 2004-02-01 23:33:44+01:00, [EMAIL PROTECTED]
  - fix a race in relation to memory allocation
  - fix memory allocations in block io path


 usb.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)


diff -Nru a/drivers/usb/usb.c b/drivers/usb/usb.c
--- a/drivers/usb/usb.c Sun Feb  1 23:34:27 2004
+++ b/drivers/usb/usb.c Sun Feb  1 23:34:27 2004
@@ -1106,7 +1106,6 @@
        init_waitqueue_head(&awd.wqh);  
        awd.done = 0;
 
-       set_current_state(TASK_UNINTERRUPTIBLE);
        add_wait_queue(&awd.wqh, &wait);
 
        urb->context = &awd;
@@ -1114,10 +1113,10 @@
        if (status) {
                // something went wrong
                usb_free_urb(urb);
-               set_current_state(TASK_RUNNING);
                remove_wait_queue(&awd.wqh, &wait);
                return status;
        }
+       set_current_state(TASK_UNINTERRUPTIBLE);
 
        while (timeout && !awd.done)
        {
@@ -1958,7 +1957,7 @@
        if (result < 0)
                return result;
 
-       buffer = kmalloc(sizeof(status), GFP_KERNEL);
+       buffer = kmalloc(sizeof(status), GFP_NOIO);
        if (!buffer) {
                err("unable to allocate memory for configuration descriptors");
                return -ENOMEM;
@@ -2079,7 +2078,7 @@
 
        dev->config = (struct usb_config_descriptor *)
                kmalloc(dev->descriptor.bNumConfigurations *
-               sizeof(struct usb_config_descriptor), GFP_KERNEL);
+               sizeof(struct usb_config_descriptor), GFP_NOIO);
        if (!dev->config) {
                err("out of memory");
                return -ENOMEM; 
@@ -2088,13 +2087,13 @@
                sizeof(struct usb_config_descriptor));
 
        dev->rawdescriptors = (char **)kmalloc(sizeof(char *) *
-               dev->descriptor.bNumConfigurations, GFP_KERNEL);
+               dev->descriptor.bNumConfigurations, GFP_NOIO);
        if (!dev->rawdescriptors) {
                err("out of memory");
                return -ENOMEM;
        }
 
-       buffer = kmalloc(8, GFP_KERNEL);
+       buffer = kmalloc(8, GFP_NOIO);
        if (!buffer) {
                err("unable to allocate memory for configuration descriptors");
                return -ENOMEM;
@@ -2118,7 +2117,7 @@
                /* Get the full buffer */
                length = le16_to_cpu(desc->wTotalLength);
 
-               bigbuffer = kmalloc(length, GFP_KERNEL);
+               bigbuffer = kmalloc(length, GFP_NOIO);
                if (!bigbuffer) {
                        err("unable to allocate memory for configuration descriptors");
                        result = -ENOMEM;

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


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


begin 664 bkpatch31539
M'XL(`/-^'4```ZU4;6_:,!#^'/[EMAIL PROTECTED]&$B:JOZU`K0!0^1\8Q(8+$
ME9UTZY0?/R>IZ#IHM76+$EWBNWO\W/FY','"2#UPU#9YE!H=P5=E\H%CW],B
MDEDGD\6F2#M*Q]8W4\KZNFN5RFZ3T)UK*4TWUC*F#-F0*<_%&JS'#!S2<7<K
M^=.#'#BSZYO%W?D,H>$0+M<\B^6]S&$X1,O-653(;6>C%5]7NY4[=TDQ)MC#
MA+JLAVF)?4R\LN='W&<N#CR/1402U/`Y.T#\-12S0'W":([EMAIL PROTECTED],K(!U"
M*0;,NIAV,0'J#EQWP-@))@.,X6UH."'0QN@"_IW_)1+0AE7R'3AH+B0D&6BY
MY7FB,[EMAIL PROTECTED])[EMAIL PROTECTED];B+W_.8*G=IOS:0*'[EMAIL 
PROTECTED]@JVUYZ+I2]M1^R\O
MA##'Z/1`K9&N&F2ZA5E63T?\4K-';,W,[EMAIL PROTECTED]>UQX3(@^9DR^T]C#D`Q3
M"TE=E]&2]KP^J86T%WI84!\D^9ZPWB!)B&LY6I:EB^VAUP)C;$]>]`_DU8.V
M_Q_E50M+J"Q*:EE9F5C:X;+8;L+4Q*WC.BB2/&K$4RG0V`$5*I*UCF"E-)A<
M:1Y+JZGF#";0UM_JVVIDNG\<'Q#:%2$X`%)9XEL[(L3.)T&.91.*0FN9Y:')
M>2Y;\_/[VW`Q'HWGU[/98CH?7=Q='W^VF4&/U)F-=9;%:B4U#&&3UI/2,LD/
MJ5:M"[EMAIL PROTECTED]'$]&DRJ9XCZMDI^MX^R"=2'RNFFVBZLD#B-IA$X>;$OV
M(`+20-36<2+YV#Y]">\LQT5Z68,4NAG;/0#_&<`_6$#_MWA"FPT;ZSC+)-[+
@V<HLSM>O$G>_:+&[EMAIL PROTECTED]"/H)4/4E(1T&````
`
end



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to