]> git.karo-electronics.de Git - karo-tx-linux.git/commit
libata bugfix: HDIO_DRIVE_TASK
authorMark Lord <liml@rtr.ca>
Wed, 28 Mar 2007 22:35:21 +0000 (18:35 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 6 Apr 2007 10:43:17 +0000 (03:43 -0700)
commit66478673825757e8ef8ab3d1ceaa4115274d1b57
treec94a46962117ce677e2584141869310badfce8dc
parent59e23e6198366f057ea49127f810098424d3417c
libata bugfix: HDIO_DRIVE_TASK

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>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/ata/libata-scsi.c