linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Ramsay <jim.ramsay@gmail.com>
To: Matthew Dharm <mdharm-kernel@one-eyed-alien.net>,
	linux-usb-users@lists.sourceforge.net,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	linux-scsi@vger.kernel.org
Subject: Re: [Linux-usb-users] Possible bug in usb storage (2.6.11 kernel)
Date: Thu, 8 Sep 2005 14:28:09 -0600	[thread overview]
Message-ID: <4789af9e05090813287f05e12a@mail.gmail.com> (raw)
In-Reply-To: <4789af9e05090812521d9d687b@mail.gmail.com>

On 9/8/05, Jim Ramsay <jim.ramsay@gmail.com> wrote:
> On 9/8/05, Matthew Dharm <mdharm-kernel@one-eyed-alien.net> wrote:
> > On Thu, Sep 08, 2005 at 11:14:36AM -0600, Jim Ramsay wrote:
> > > I think I have found a possible bug:
> > > [...]
> > > I suppose the scsi code could be changed to guarantee that
> > > srb->request_buffer is page-aligned or cache-aligned, but that seems
> > > like the wrong solution for this bug.
> >
> > Fixing the SCSI layer is -exactly- the correct solution.  The SCSI layer is
> > supposed to guarantee us that those buffers are suitable for DMA'ing, and
> > apparently it's violating that promise.
> 
> Thanks, I'll check on what buffer I'm actually getting, where it's
> allocated, and post back what I find, or how I fixed it.

More information:

The error only occurrs during device sensing when the
srb->request_buffer is assigned as follows, by usb/storage/transport.c
in the routine usb_stor_invoke_transport:

old_request_buffer = srb->request_buffer;
srb->request_buffer = srb->sense_buffer;

Now, this is a problem because srb->sense_buffer is defined as follows
in the struct scsi_cmnd:

#define SCSI_SENSE_BUFFERSIZE   96
        unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];

Since it is not allocated at runtime there is NO WAY the SCSI layer
can possibly guarantee it is page- or cache-aligned and ready for DMA.

Any suggestions on best fix for this?  Is it still a SCSI-layer issue?
 Or should USB step up in this case and ensure this buffer is dma-safe
itself?

-- 
Jim Ramsay
"Me fail English?  That's unpossible!"

       reply	other threads:[~2005-09-08 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4789af9e05090810142bd3531d@mail.gmail.com>
     [not found] ` <20050908175852.GA3196@one-eyed-alien.net>
     [not found]   ` <4789af9e05090812521d9d687b@mail.gmail.com>
2005-09-08 20:28     ` Jim Ramsay [this message]
2005-09-08 20:40       ` Possible bug in usb storage (2.6.11 kernel) Alan Stern
2005-09-27 13:38         ` Atsushi Nemoto
2005-09-27 14:21           ` [Linux-usb-users] " Alan Stern
2005-09-27 14:46             ` Atsushi Nemoto
2005-09-27 15:38               ` [Linux-usb-users] " Alan Stern
2005-09-28 16:27                 ` Atsushi Nemoto
2005-09-30 16:48                   ` Ralf Baechle
2005-09-08 20:43       ` Matthew Dharm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4789af9e05090813287f05e12a@mail.gmail.com \
    --to=jim.ramsay@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb-users@lists.sourceforge.net \
    --cc=mdharm-kernel@one-eyed-alien.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).