[PATCH] libata: take scmd->cmd_len into account when translating SCSI commands
authorTejun Heo <htejun@gmail.com>
Sun, 17 Dec 2006 01:46:33 +0000 (10:46 +0900)
committerJeff Garzik <jeff@garzik.org>
Wed, 20 Dec 2006 19:26:26 +0000 (14:26 -0500)
commit2e5704f63ed56b040a3189f6b7eb17f6f849ea22
tree4b3df2d375da3fefa5a8d22f6f41a9e5f7ce5798
parentad706991f4f0d1476aecbdae2df5e36552b340b2
[PATCH] libata: take scmd->cmd_len into account when translating SCSI commands

libata depended on SCSI command to have the correct length when
tranlating it into an ATA command.  This generally worked for commands
issued by SCSI HLD but user could issue arbitrary broken command using
sg interface.

Also, when building ATAPI command, full command size was always
copied.  Because some ATAPI devices needs bytes after CDB cleared, if
upper layer doesn't clear bytes after CDB, such devices will
malfunction.  This necessiated recent clear-garbage-after-CDB fix in
sg interfaces.  However, scsi_execute() isn't fixed yet and HL-DT-ST
DVD-RAM GSA-H30N malfunctions on initialization commands issued from
SCSI.

This patch makes xlat functions always consider SCSI cmd_len.  Each
translation function checks for proper cmd_len and ATAPI translaation
clears bytes after CDB.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Douglas Gilbert <dougg@torque.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-scsi.c