aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorMark Lord <liml@rtr.ca>2007-02-07 11:40:12 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-21 04:58:17 -0500
commit2b06719153089aa8f5ac577f15f8aa8e5b5fe357 (patch)
tree306d99bdb306a43aab31f7a6104b54b8e68dccfd /drivers/ata/libata-scsi.c
parent909706a2477a92b6e0f3083ed4b944cb1d09acfa (diff)
libata bugfix: HDIO_DRIVE_TASK
I was trying to use HDIO_DRIVE_TASK for something today, and discovered that the libata implementation does not copy over the upper four LBA bits from args[6]. This is serious, as any tools using this ioctl would have their commands applied to the wrong sectors on the drive, possibly resulting in disk corruption. Ideally, newer apps should use SG_IO/ATA_16 directly, avoiding this bug. But with libata poised to displace drivers/ide, better compatibility here is a must. This patch fixes libata to use the upper four LBA bits passed in from the ioctl. The original drivers/ide implementation copies over all bits except for the master/slave select bit. With this patch, libata will copy only the four high-order LBA bits, just in case there are assumptions elsewhere in libata (?). Signed-Off-By: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 0009818a4306..d1bf1ca4f717 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -333,6 +333,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
333 scsi_cmd[8] = args[3]; 333 scsi_cmd[8] = args[3];
334 scsi_cmd[10] = args[4]; 334 scsi_cmd[10] = args[4];
335 scsi_cmd[12] = args[5]; 335 scsi_cmd[12] = args[5];
336 scsi_cmd[13] = args[6] & 0x0f;
336 scsi_cmd[14] = args[0]; 337 scsi_cmd[14] = args[0];
337 338
338 /* Good values for timeout and retries? Values below 339 /* Good values for timeout and retries? Values below