On Mon, 4 Feb 2008, Lal wrote:

> I have developed a sample USB mass storage driver. Using this driver,
> I can mount file system on my CF card, and can read/write small files
> to/from CF card. However, the driver crashes while reading/writing
> large files.
> From kernel stack trace, it seems there is some synchronization issue
> with interrupts. I see kernel stack something like this:

> Looking at the stack trace, it seems, some locking mechanism is
> required. I am referring to LDD3 chapter 13 (USB Drivers) and chapter
> 16 (Block drivers). The driver does USB read/write as follows:
> 
> my_request_queue_function
> check if request is read or write
> allocate and fill urb (using req->sector and req->current_nr_sectors)
> submit urb
> wait to complete
> copy data to req->buffer

> during this process, I have not taken any lock. Can someone give some
> hint, if some lock is required here?
> I do not submit any urb in complete function of usb_fill_bulk_urb. I
> am not able to get which other part can be executed in interrupt
> context (if I am right, request queue function is not called in
> interrupt context).

I believe you are wrong: The request_queue function _is_ called in 
an atomic context.  Hence your "wait to complete" step is problematic.

Alan Stern

-
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to