15 Feb, 2019

1 commit

  • If an smbus transfer fails, there's no guarantee that the output
    buffer was written. So, avoid trying to show the output buffer when
    tracing after an error. This was 'mostly harmless', but would trip
    up kasan checking if left-over cruft in byte 0 is a large length,
    causing us to read from unwritten memory.

    Signed-off-by: John Sperbeck
    Reviewed-by: Steven Rostedt (VMware)
    Signed-off-by: Wolfram Sang

    John Sperbeck
     

21 Jul, 2018

1 commit

  • Removes all locking from i2c_smbus_xfer and renames it to __i2c_smbus_xfer,
    then adds a new i2c_smbus_xfer function that simply grabs the lock while
    calling the unlocked variant.

    This is not perfectly equivalent, since i2c_smbus_xfer was callable from
    atomic/irq context if you happened to end up emulating SMBus with an I2C
    transfer, and that is no longer the case with this patch. It is unknown
    (to me) if anything depends on that quirk, but it seems fragile enough to
    simply break those cases and require them to call i2c_transfer directly
    instead.

    While at it, for consistency rename the 2nd to last argument (size) of
    the i2c_smbus_xfer declaration to protocol and remove the surplus extern
    marker.

    Signed-off-by: Peter Rosin
    Signed-off-by: Wolfram Sang

    Peter Rosin
     

29 Jun, 2018

1 commit


17 May, 2018

1 commit

  • In i2c_smbus_xfer_emulated(), the function i2c_transfer() is invoked to
    transfer i2c messages. The number of actual transferred messages is
    returned and saved to 'status'. If 'status' is negative, that means an
    error occurred during the transfer process. In that case, the value of
    'status' is an error code to indicate the reason of the transfer failure.
    In most cases, i2c_transfer() can transfer 'num' messages with no error.
    And so 'status' == 'num'. However, due to unexpected errors, it is probable
    that only partial messages are transferred by i2c_transfer(). As a result,
    'status' != 'num'. This special case is not checked after the invocation of
    i2c_transfer() and can potentially lead to unexpected issues in the
    following execution since it is expected that 'status' == 'num'.

    This patch checks the return value of i2c_transfer() and returns an error
    code -EIO if the number of actual transferred messages 'status' is not
    equal to 'num'.

    Signed-off-by: Wenwen Wang
    Signed-off-by: Wolfram Sang

    Wenwen Wang
     

27 Feb, 2018

1 commit


05 Feb, 2018

1 commit

  • Pull i2c updates from Wolfram Sang:
    "I2C has the following changes for you:

    - new flag to mark DMA safe buffers in i2c_msg. Also, some
    infrastructure around it. And docs.

    - huge refactoring of the at24 driver led by the new maintainer
    Bartosz

    - update I2C bus recovery to send STOP after recovery

    - conversion from gpio to gpiod for I2C bus recovery

    - adding a fault-injector to the i2c-gpio driver

    - lots of small driver improvements, and bigger ones to
    i2c-sh_mobile"

    * 'i2c/for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (99 commits)
    i2c: mv64xxx: Add myself as maintainer for this driver
    i2c: mv64xxx: Fix clock resource by adding an optional bus clock
    i2c: mv64xxx: Remove useless test before clk_disable_unprepare
    i2c: mxs: use true and false for boolean values
    i2c: meson: update doc description to fix build warnings
    i2c: meson: add configurable divider factors
    dt-bindings: i2c: update documentation for the Meson-AXG
    i2c: imx-lpi2c: add runtime pm support
    i2c: rcar: fix some trivial typos in comments
    i2c: davinci: fix the cpufreq transition
    i2c: rk3x: add proper kerneldoc header
    i2c: rk3x: account for const type of of_device_id.data
    i2c: acorn: remove outdated path from file header
    i2c: acorn: add MODULE_LICENSE tag
    i2c: rcar: implement bus recovery
    i2c: send STOP after successful bus recovery
    i2c: ensure SDA is released in recovery if SDA is controllable
    i2c: add 'set_sda' to bus_recovery_info
    i2c: add identifier in declarations for i2c_bus_recovery
    i2c: make kerneldoc about bus recovery more precise
    ...

    Linus Torvalds
     

17 Jan, 2018

1 commit

  • On a I2C_SMBUS_I2C_BLOCK_DATA read request, if data->block[0] is
    greater than I2C_SMBUS_BLOCK_MAX + 1, the underlying I2C driver writes
    data out of the msgbuf1 array boundary.

    It is possible from a user application to run into that issue by
    calling the I2C_SMBUS ioctl with data.block[0] greater than
    I2C_SMBUS_BLOCK_MAX + 1.

    This patch makes the code compliant with
    Documentation/i2c/dev-interface by raising an error when the requested
    size is larger than 32 bytes.

    Call Trace:
    [] dump_stack+0x67/0x92
    [] panic+0xc5/0x1eb
    [] ? vprintk_default+0x1f/0x30
    [] ? i2cdev_ioctl_smbus+0x303/0x320
    [] __stack_chk_fail+0x1b/0x20
    [] i2cdev_ioctl_smbus+0x303/0x320
    [] i2cdev_ioctl+0x4d/0x1e0
    [] do_vfs_ioctl+0x2ba/0x490
    [] ? security_file_ioctl+0x43/0x60
    [] SyS_ioctl+0x79/0x90
    [] entry_SYSCALL_64_fastpath+0x12/0x6a

    Signed-off-by: Jeremy Compostella
    Signed-off-by: Wolfram Sang
    Cc: stable@kernel.org

    Jeremy Compostella
     

04 Dec, 2017

1 commit


29 Oct, 2017

2 commits


01 Jun, 2017

1 commit