Libata disk corruptor paths ?

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

 



Found these by inspection:

Command issuing goes via ata_qc_reinit() which sets up the device bits
for the command to include the device select bit.

If we are using NCQ then the code in ata_build_rw_tf sets bit 6 directly
without using |= which clears the device select bit and means any NCQ
command will go to the first device regardless.

The non NCQ path thankfully doesn't blat the other bits and right now we
have no slave devices on NCQ supporting hardware I believe.

The same bug is present in the libata patches for HPA, and it pulls the
primary HPA blindly in each case. I've not found any others but they may
be there and the code is a bit fragile around here. I suspect this is the
Macintosh problem.

Is there a reason we can't make exec_internel and/or qc_issue BUG() if
the passed device and tf device bit disagree ?

There is another ugly here too ata_tf_init sets the device bits but
doesn't set TFLAG_DEVICE. Scarily in fact the qc_reinit path that
produces new qc structures doesn't touch tf->flags at all but leaves them
as they were previously (with or without device). Any command issued with
a device set but the flag forgotten is going to work *until* we issue a
command to one device and forget the flag, after a command to another
device, in which case the wrong device will get the command. There are
other flags that will cause lunacy to occur as well - LBA48 being an
obvious one that will blow up in our faces.

Follow the path of a start_stop command - we set the device flag but we
assume the newly allocated command flags started clear, not random. We
don't clear the LBA48 flag either....

Alan



	
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux