ChangeSet 1.1500.8.8, 2004/01/29 16:29:48-08:00, [EMAIL PROTECTED]

[PATCH] USB: fix Bug 1821: sleeping function called

> Data point:  "visor.c" always passes GFP_ATOMIC there.

Here's a patch that makes cdc-acm use GFP_ATOMIC too,
and report consequent allocation failures.  Compiles
but otherwise untested.


 drivers/usb/class/cdc-acm.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c       Mon Feb  9 14:41:40 2004
+++ b/drivers/usb/class/cdc-acm.c       Mon Feb  9 14:41:40 2004
@@ -399,6 +399,7 @@
 static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned char 
*buf, int count)
 {
        struct acm *acm = tty->driver_data;
+       int stat;
 
        if (!ACM_READY(acm))
                return -EINVAL;
@@ -418,8 +419,12 @@
        acm->writeurb->transfer_buffer_length = count;
        acm->writeurb->dev = acm->dev;
 
-       if (usb_submit_urb(acm->writeurb, GFP_KERNEL))
+       /* GFP_KERNEL probably works if from_user */
+       stat = usb_submit_urb(acm->writeurb, GFP_ATOMIC);
+       if (stat < 0) {
                dbg("usb_submit_urb(write bulk) failed");
+               return stat;
+       }
 
        return count;
 }



-------------------------------------------------------
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