Re: Short INQUIRY return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux