]> Git Repo - linux.git/commit
i2c: dev: prevent adapter retries and timeout being set as minus value
authorYi Zeng <[email protected]>
Wed, 9 Jan 2019 07:33:07 +0000 (15:33 +0800)
committerWolfram Sang <[email protected]>
Thu, 10 Jan 2019 23:14:55 +0000 (00:14 +0100)
commit6ebec961d59bccf65d08b13fc1ad4e6272a89338
treec5ecbd4f0fb87422ec47bd20fe19343f675da7a8
parentbfeffd155283772bbe78c6a05dec7c0128ee500c
i2c: dev: prevent adapter retries and timeout being set as minus value

If adapter->retries is set to a minus value from user space via ioctl,
it will make __i2c_transfer and __i2c_smbus_xfer skip the calling to
adapter->algo->master_xfer and adapter->algo->smbus_xfer that is
registered by the underlying bus drivers, and return value 0 to all the
callers. The bus driver will never be accessed anymore by all users,
besides, the users may still get successful return value without any
error or information log print out.

If adapter->timeout is set to minus value from user space via ioctl,
it will make the retrying loop in __i2c_transfer and __i2c_smbus_xfer
always break after the the first try, due to the time_after always
returns true.

Signed-off-by: Yi Zeng <[email protected]>
[wsa: minor grammar updates to commit message]
Signed-off-by: Wolfram Sang <[email protected]>
Cc: [email protected]
drivers/i2c/i2c-dev.c
This page took 0.043155 seconds and 4 git commands to generate.