On Tue, 27 Jul 2004 00:52:52 -0500
Dmitry Torokhov <[EMAIL PROTECTED]> wrote:

> Got the following OOps when when turning off a all-in-one USB printer/scanner
> after scanning an image with Xsane and leaving Xsane window open.

> EIP is at usb_buffer_free+0x1a/0x50 [usbcore]
> Process ptal-mlcd (pid: 2292, threadinfo=dd77c000 task=df8e80f0)
> Call Trace:
>  [<c01054fa>] show_stack+0x7a/0x90
>  [<c010567a>] show_registers+0x14a/0x1b0
>  [<c010580d>] die+0x8d/0x100
>  [<c0114097>] do_page_fault+0x1f7/0x540
>  [<c0105195>] error_code+0x2d/0x38
>  [<e0f153de>] usblp_cleanup+0x3e/0x90 [usblp]
>  [<e0f154b7>] usblp_release+0x57/0x60 [usblp]
>  [<c014f437>] __fput+0x117/0x130
>  [<c014dcdf>] filp_close+0x4f/0x80
>  [<c0104feb>] syscall_call+0x7/0xb

This looks awfully familiar. In fact I'm sure I have fixed this for 2.4.

Is this reproducible? If yes, pleas try the appended patch and let us
know if it fixes the problem (it's a forward port of my fix from the
Marcelo tree).

-- Pete

--- linux-2.6.7/drivers/usb/class/usblp.c       2004-06-16 16:53:58.000000000 -0700
+++ linux-2.6.7-usb/drivers/usb/class/usblp.c   2004-07-27 00:20:04.265195863 -0700
@@ -219,6 +219,7 @@
 
 /* forward reference to make our lives easier */
 extern struct usb_driver usblp_driver;
+static DECLARE_MUTEX(usblp_sem);       /* locks the existence of usblp's. */
 
 /*
  * Functions for usblp control messages.
@@ -340,7 +341,7 @@
        if (minor < 0)
                return -ENODEV;
 
-       lock_kernel();
+       down (&usblp_sem);
 
        retval = -ENODEV;
        intf = usb_find_interface(&usblp_driver, minor);
@@ -386,7 +387,7 @@
                }
        }
 out:
-       unlock_kernel();
+       up (&usblp_sem);
        return retval;
 }
 
@@ -416,13 +417,13 @@
 {
        struct usblp *usblp = file->private_data;
 
-       down (&usblp->sem);
+       down (&usblp_sem);
        usblp->used = 0;
        if (usblp->present) {
                usblp_unlink_urbs(usblp);
-               up(&usblp->sem);
        } else          /* finish cleanup from disconnect */
                usblp_cleanup (usblp);
+       up (&usblp_sem);
        return 0;
 }
 
@@ -761,6 +762,7 @@
                        usblp->minor, usblp->readurb->status);
                usblp->readurb->dev = usblp->dev;
                usblp->readcount = 0;
+               usblp->rcomplete = 0;
                if (usb_submit_urb(usblp->readurb, GFP_KERNEL) < 0)
                        dbg("error submitting urb");
                count = -EIO;
@@ -1142,18 +1144,17 @@
                BUG ();
        }
 
+       down (&usblp_sem);
        down (&usblp->sem);
-       lock_kernel();
        usblp->present = 0;
        usb_set_intfdata (intf, NULL);
 
        usblp_unlink_urbs(usblp);
+       up (&usblp->sem);
 
        if (!usblp->used)
                usblp_cleanup (usblp);
-       else    /* cleanup later, on release */
-               up (&usblp->sem);
-       unlock_kernel();
+       up (&usblp_sem);
 }
 
 static struct usb_device_id usblp_ids [] = {


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to