All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Sabourenkov <screwdriver@lxnt.info>
To: Boaz Harrosh <bharrosh@panasas.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: Short INQUIRY return
Date: Thu, 25 Oct 2007 22:54:08 +0400	[thread overview]
Message-ID: <4720E650.9070304@lxnt.info> (raw)
In-Reply-To: <4720AB30.5080003@panasas.com>

Boaz Harrosh wrote:
> 
> Just at the top of my head without looking at the code at all. I would
> say the bigest change would be the use of use_sg != 0 for all commands
> in Later kernels. (k>=2.6.17)
>
> Look for and around the scsi_cmnd->request_buffer usage. It used to be
> that for commands like INQUIRY it points to a linear char pointer.
> Today it will always point to a scatterlist array and use_sg is the sg count
> of that array. (Usually ==1 in the INQUIRY case)

That was it. Driver blindly wrote whatever number of bytes it felt like
straight to the pointer.

I lifted some code from scsi_debug.c:

sgpnt = (struct scatterlist *)SCpnt->request_buffer;
kaddr = (unsigned char *)kmap_atomic(sgpnt->page, KM_USER0);
buff = kaddr + sgpnt->offset;
bufflen = sgpnt->length;

buf[...] = ...

kunmap_atomic(kaddr, KM_USER0);

which seemed to do the trick.
(is this the proper way or it works by some miracle only?)

I tried
dd if=/dev/sdc1 of=/dev/null bs=1048576 count=1024
and the kernel crashed. Not surprising.

Now up-hacking MODE_SENSE support based on drivers/usb/storage/datafab.c

> Just a shot in the dark

Thank you very much.

> (Where is the code for that driver?)

I found it at promise.com:
http://www.promise.com/support/download/download2_eng.asp?productId=139&category=driver&os=100&go=GO


My current version is at http://lxnt.info/tx4/023/
(modified files only)

The code in cam subdirectory is quite clean - I suspect it is some
OS-independent part that is used in Windows and BIOS too. I did not
touch it.


-- 

./lxnt

      reply	other threads:[~2007-10-25 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-25 13:03 Short INQUIRY return Alexander Sabourenkov
2007-10-25 14:41 ` Boaz Harrosh
2007-10-25 18:54   ` Alexander Sabourenkov [this message]

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=4720E650.9070304@lxnt.info \
    --to=screwdriver@lxnt.info \
    --cc=bharrosh@panasas.com \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.