]> git.baikalelectronics.ru Git - kernel.git/commit
libata bugfix: HDIO_DRIVE_TASK
authorMark Lord <liml@rtr.ca>
Wed, 7 Feb 2007 16:40:12 +0000 (11:40 -0500)
committerJeff Garzik <jeff@garzik.org>
Wed, 21 Feb 2007 09:58:17 +0000 (04:58 -0500)
commit0fbcf2f419750e8804c4f79822da5fe67e4f2d39
tree306d99bdb306a43aab31f7a6104b54b8e68dccfd
parent73ca1488d147f3ca864c4ba8c606fed53af485c5
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>
drivers/ata/libata-scsi.c