On Tue, 27 Jul 2004, Pete Zaitcev wrote:

> 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

I suspect Pete's patch doesn't really address this problem.  The oops is
caused by the fact that usblp_release() calls usblp_cleanup() which in 
turn calls usb_buffer_free() _after_ usblp_disconnect() has returned and 
the device is gone.  That's not a good thing to do.

The patch below (which can be used independently of Pete's patch) should
fix this problem.  It moves the call to usb_buffer_free() out of the
cleanup routine and into the disconnect routine.  Be warned that I haven't 
tested it!

Alan Stern



Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

--- 2.6/drivers/usb/class/usblp.c       Tue Jul 27 10:23:12 2004
+++ 2.6/drivers/usb/class/usblp.c       Tue Jul 27 10:26:55 2004
@@ -398,10 +398,6 @@
 {
        info("usblp%d: removed", usblp->minor);
 
-       usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
-                       usblp->writebuf, usblp->writeurb->transfer_dma);
-       usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
-                       usblp->readbuf, usblp->readurb->transfer_dma);
        kfree (usblp->device_id_string);
        kfree (usblp->statusbuf);
        usb_free_urb(usblp->writeurb);
@@ -1160,6 +1156,10 @@
        usb_set_intfdata (intf, NULL);
 
        usblp_unlink_urbs(usblp);
+       usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
+                       usblp->writebuf, usblp->writeurb->transfer_dma);
+       usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
+                       usblp->readbuf, usblp->readurb->transfer_dma);
        up (&usblp->sem);
 
        if (!usblp->used)



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