SIGN IN SIGN UP

SmbusI801, SmbusPIIX4: validate direction and address up front

Both drivers took the direction and the slave address from the caller and
went straight to hardware with them.

Only the low bit of the direction reaches SMBHSTADD, but the rest of the
code compares the whole value against I2C_SMBUS_WRITE. A direction of 2
therefore followed the read path in software while the controller started
a write, sending whatever was left in the data registers. The same
unbounded value feeds the transfer time estimate: on PIIX4 with a timing
of 165, a direction of 10000000 works out to an initial busy wait of
about 900 seconds. Addresses wider than 7 bits silently aliased another
slave.

Require the direction to be exactly 0 or 1 and the address to fit in 7
bits, before any PCI or controller state is touched.
N
namazso committed
36d74fc25f3e62a8fe07086d8e3d1b097fe126bb
Parent: 78dac3e