<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/i2c/i2c-core.c, branch linux-4.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-04-27T07:33:47Z</updated>
<entry>
<title>i2c: core-smbus: prevent stack corruption on read I2C_BLOCK_DATA</title>
<updated>2019-04-27T07:33:47Z</updated>
<author>
<name>Jeremy Compostella</name>
</author>
<published>2017-11-15T19:31:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=02bfc06ca2fa1158d6cd2e5688bfc4ef278d8425'/>
<id>urn:sha1:02bfc06ca2fa1158d6cd2e5688bfc4ef278d8425</id>
<content type='text'>
commit 89c6efa61f5709327ecfa24bff18e57a4e80c7fa upstream.

On a I2C_SMBUS_I2C_BLOCK_DATA read request, if data-&gt;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:
 [&lt;ffffffff8139f695&gt;] dump_stack+0x67/0x92
 [&lt;ffffffff811802a4&gt;] panic+0xc5/0x1eb
 [&lt;ffffffff810ecb5f&gt;] ? vprintk_default+0x1f/0x30
 [&lt;ffffffff817456d3&gt;] ? i2cdev_ioctl_smbus+0x303/0x320
 [&lt;ffffffff8109a68b&gt;] __stack_chk_fail+0x1b/0x20
 [&lt;ffffffff817456d3&gt;] i2cdev_ioctl_smbus+0x303/0x320
 [&lt;ffffffff81745aed&gt;] i2cdev_ioctl+0x4d/0x1e0
 [&lt;ffffffff811f761a&gt;] do_vfs_ioctl+0x2ba/0x490
 [&lt;ffffffff81336e43&gt;] ? security_file_ioctl+0x43/0x60
 [&lt;ffffffff811f7869&gt;] SyS_ioctl+0x79/0x90
 [&lt;ffffffff81a22e97&gt;] entry_SYSCALL_64_fastpath+0x12/0x6a

Signed-off-by: Jeremy Compostella &lt;jeremy.compostella@intel.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Cc: stable@kernel.org
[connoro@google.com: 4.9 backport: adjust filename]
Signed-off-by: Connor O'Brien &lt;connoro@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>i2c: print correct device invalid address</title>
<updated>2017-01-19T19:17:20Z</updated>
<author>
<name>John Garry</name>
</author>
<published>2017-01-06T11:02:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f64b9acc368c3a535510291aaf4e86787f8d10d3'/>
<id>urn:sha1:f64b9acc368c3a535510291aaf4e86787f8d10d3</id>
<content type='text'>
commit 6f724fb3039522486fce2e32e4c0fbe238a6ab02 upstream.

In of_i2c_register_device(), when the check for
device address validity fails we print the info.addr,
which has not been assigned properly.

Fix this by printing the actual invalid address.

Signed-off-by: John Garry &lt;john.garry@huawei.com&gt;
Reviewed-by: Vladimir Zapolskiy &lt;vz@mleia.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Fixes: b4e2f6ac1281 ("i2c: apply DT flags when probing")
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>i2c: core: fix NULL pointer dereference under race condition</title>
<updated>2016-11-10T15:36:31Z</updated>
<author>
<name>Vladimir Zapolskiy</name>
</author>
<published>2016-10-31T19:46:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4125fe7f8d31ed5be7df809dd3020eb39ab99257'/>
<id>urn:sha1:4125fe7f8d31ed5be7df809dd3020eb39ab99257</id>
<content type='text'>
commit 147b36d5b70c083cc76770c47d60b347e8eaf231 upstream.

Race condition between registering an I2C device driver and
deregistering an I2C adapter device which is assumed to manage that
I2C device may lead to a NULL pointer dereference due to the
uninitialized list head of driver clients.

The root cause of the issue is that the I2C bus may know about the
registered device driver and thus it is matched by bus_for_each_drv(),
but the list of clients is not initialized and commonly it is NULL,
because I2C device drivers define struct i2c_driver as static and
clients field is expected to be initialized by I2C core:

  i2c_register_driver()             i2c_del_adapter()
    driver_register()                 ...
      bus_add_driver()                ...
        ...                           bus_for_each_drv(..., __process_removed_adapter)
      ...                               i2c_do_del_adapter()
    ...                                   list_for_each_entry_safe(..., &amp;driver-&gt;clients, ...)
    INIT_LIST_HEAD(&amp;driver-&gt;clients);

To solve the problem it is sufficient to do clients list head
initialization before calling driver_register().

The problem was found while using an I2C device driver with a sluggish
registration routine on a bus provided by a physically detachable I2C
master controller, but practically the oops may be reproduced under
the race between arbitraty I2C device driver registration and managing
I2C bus device removal e.g. by unbinding the latter over sysfs:

% echo 21a4000.i2c &gt; /sys/bus/platform/drivers/imx-i2c/unbind
  Unable to handle kernel NULL pointer dereference at virtual address 00000000
  Internal error: Oops: 17 [#1] SMP ARM
  CPU: 2 PID: 533 Comm: sh Not tainted 4.9.0-rc3+ #61
  Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
  task: e5ada400 task.stack: e4936000
  PC is at i2c_do_del_adapter+0x20/0xcc
  LR is at __process_removed_adapter+0x14/0x1c
  Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
  Control: 10c5387d  Table: 35bd004a  DAC: 00000051
  Process sh (pid: 533, stack limit = 0xe4936210)
  Stack: (0xe4937d28 to 0xe4938000)
  Backtrace:
  [&lt;c0667be0&gt;] (i2c_do_del_adapter) from [&lt;c0667cc0&gt;] (__process_removed_adapter+0x14/0x1c)
  [&lt;c0667cac&gt;] (__process_removed_adapter) from [&lt;c0516998&gt;] (bus_for_each_drv+0x6c/0xa0)
  [&lt;c051692c&gt;] (bus_for_each_drv) from [&lt;c06685ec&gt;] (i2c_del_adapter+0xbc/0x284)
  [&lt;c0668530&gt;] (i2c_del_adapter) from [&lt;bf0110ec&gt;] (i2c_imx_remove+0x44/0x164 [i2c_imx])
  [&lt;bf0110a8&gt;] (i2c_imx_remove [i2c_imx]) from [&lt;c051a838&gt;] (platform_drv_remove+0x2c/0x44)
  [&lt;c051a80c&gt;] (platform_drv_remove) from [&lt;c05183d8&gt;] (__device_release_driver+0x90/0x12c)
  [&lt;c0518348&gt;] (__device_release_driver) from [&lt;c051849c&gt;] (device_release_driver+0x28/0x34)
  [&lt;c0518474&gt;] (device_release_driver) from [&lt;c0517150&gt;] (unbind_store+0x80/0x104)
  [&lt;c05170d0&gt;] (unbind_store) from [&lt;c0516520&gt;] (drv_attr_store+0x28/0x34)
  [&lt;c05164f8&gt;] (drv_attr_store) from [&lt;c0298acc&gt;] (sysfs_kf_write+0x50/0x54)
  [&lt;c0298a7c&gt;] (sysfs_kf_write) from [&lt;c029801c&gt;] (kernfs_fop_write+0x100/0x214)
  [&lt;c0297f1c&gt;] (kernfs_fop_write) from [&lt;c0220130&gt;] (__vfs_write+0x34/0x120)
  [&lt;c02200fc&gt;] (__vfs_write) from [&lt;c0221088&gt;] (vfs_write+0xa8/0x170)
  [&lt;c0220fe0&gt;] (vfs_write) from [&lt;c0221e74&gt;] (SyS_write+0x4c/0xa8)
  [&lt;c0221e28&gt;] (SyS_write) from [&lt;c0108a20&gt;] (ret_fast_syscall+0x0/0x1c)

Signed-off-by: Vladimir Zapolskiy &lt;vladimir_zapolskiy@mentor.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>i2c: fix wakeup irq parsing</title>
<updated>2015-11-20T15:19:08Z</updated>
<author>
<name>Grygorii Strashko</name>
</author>
<published>2015-11-12T13:42:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c18fba23061f16dde128e10d4869ba4e88e0e81a'/>
<id>urn:sha1:c18fba23061f16dde128e10d4869ba4e88e0e81a</id>
<content type='text'>
This patch fixes obvious copy-past error in wake up irq parsing
code which leads to the fact that dev_pm_set_wake_irq() will
be called with wrong IRQ number when "wakeup" IRQ is not
defined in DT.

Fixes: 3fffd1283927 ("i2c: allow specifying separate wakeup interrupt in device tree")
Signed-off-by: Grygorii Strashko &lt;grygorii.strashko@ti.com&gt;
Acked-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v4.3
</content>
</entry>
<entry>
<title>Merge branch 'i2c/for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux</title>
<updated>2015-11-10T19:58:25Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2015-11-10T19:58:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d55fc37856244c929965c190c8e9dcb49e2c07aa'/>
<id>urn:sha1:d55fc37856244c929965c190c8e9dcb49e2c07aa</id>
<content type='text'>
Pull i2c updates from Wolfram Sang:

 - New drivers: UniPhier (with and without FIFO)

 - some drivers got some bigger rework: ismt, designware, img-scb (rcar
   had to be reverted because issues were showing up just lately)

 - ACPI: reworked the device scanning and added support for muxes

... and quite a lot of driver bugfixes and cleanups this time.  All
files touched outside of the i2c realm have proper acks.

* 'i2c/for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (70 commits)
  i2c: rcar: Revert the latest refactoring series
  i2c: pnx: remove superfluous assignment
  MAINTAINERS: i2c: drop i2c-pnx maintainer
  MAINTAINERS: i2c: mark also subdirectories as maintained
  i2c: cadence: enable driver for ARM64
  i2c: i801: Document Intel DNV and Broxton
  i2c: at91: manage unexpected RXRDY flag when starting a transfer
  i2c: pnx: Use setup_timer instead of open coding it
  i2c: add ACPI support for I2C mux ports
  acpi: add acpi_preset_companion() stub
  i2c: pxa: Add support for pxa910/988 &amp; new configuration features
  i2c: au1550: Convert to devm_kzalloc and devm_ioremap_resource
  i2c-dev: Fix I2C_SLAVE ioctl comment
  i2c-dev: Fix typo in ioctl name reference
  i2c: sirf: tune the divider to make i2c bus freq more accurate
  i2c: imx: Use -ENXIO as error in the NACK case
  i2c: i801: Add support for Intel Broxton
  i2c: i801: Add support for Intel DNV
  i2c: mediatek: add i2c resume support
  i2c: imx: implement bus recovery
  ...
</content>
</entry>
<entry>
<title>i2c: add ACPI support for I2C mux ports</title>
<updated>2015-10-25T14:49:46Z</updated>
<author>
<name>Dustin Byford</name>
</author>
<published>2015-10-23T19:27:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8eb5c87a92c065aaca39ac3e841b07906a4959a2'/>
<id>urn:sha1:8eb5c87a92c065aaca39ac3e841b07906a4959a2</id>
<content type='text'>
Although I2C mux devices are easily enumerated using ACPI (_HID/_CID or
device property compatible string match), enumerating I2C client devices
connected through an I2C mux needs a little extra work.

This change implements a method for describing an I2C device hierarchy that
includes mux devices by using an ACPI Device() for each mux channel along
with an _ADR to set the channel number for the device.  See
Documentation/acpi/i2c-muxes.txt for a simple example.

To make this work the ismt, i801, and designware pci/platform devs now
share an ACPI companion with their I2C adapter dev similar to how it's done
in OF.  This is done on the assumption that power management functions will
not be called directly on the I2C dev that is sharing the ACPI node.

Acked-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Tested-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Signed-off-by: Dustin Byford &lt;dustin@cumulusnetworks.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c / ACPI: Rework I2C device scanning</title>
<updated>2015-10-20T14:51:14Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2015-10-07T10:18:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=166c2ba398640278ae6037be4aa5562c03cf3d24'/>
<id>urn:sha1:166c2ba398640278ae6037be4aa5562c03cf3d24</id>
<content type='text'>
The way we currently scan I2C devices behind an I2C host controller does not
work in cases where the I2C device in question is not declared directly below
the host controller ACPI node.

This is perfectly legal according the ACPI 6.0 specification and some existing
systems are doing this.

To be able to enumerate all devices which are connected to a certain I2C host
controller we need to rework the current I2C scanning routine a bit. Instead of
scanning directly below the host controller we scan the whole ACPI namespace
for present devices with valid I2cSerialBus() connection pointing to the host
controller in question.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Acked-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Tested-by: Dustin Byford &lt;dustin@cumulusnetworks.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: return probe deferred status on dev_pm_domain_attach</title>
<updated>2015-10-15T11:35:32Z</updated>
<author>
<name>Kieran Bingham</name>
</author>
<published>2015-10-12T20:54:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=74cedd30522819d87131715ca0e7d041748b2721'/>
<id>urn:sha1:74cedd30522819d87131715ca0e7d041748b2721</id>
<content type='text'>
A change of return status was introduced in commit 3fffd1283927
("i2c: allow specifying separate wakeup interrupt in device tree")

The commit prevents the defer status being passed up the call stack
appropriately when dev_pm_domain_attach returns -EPROBE_DEFER.

Catch the PROBE_DEFER and clear up the IRQ wakeup status

Signed-off-by: Kieran Bingham &lt;kieranbingham@gmail.com&gt;
Fixes: 3fffd1283927 ("i2c: allow specifying separate wakeup interrupt in device tree")
Reviewed-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: allow specifying separate wakeup interrupt in device tree</title>
<updated>2015-08-26T16:47:58Z</updated>
<author>
<name>Dmitry Torokhov</name>
</author>
<published>2015-08-18T06:52:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3fffd12839273429a185d68431f117f0a3654b07'/>
<id>urn:sha1:3fffd12839273429a185d68431f117f0a3654b07</id>
<content type='text'>
Instead of having each i2c driver individually parse device tree data in
case it or platform supports separate wakeup interrupt, and handle
enabling and disabling wakeup interrupts in their power management
routines, let's have i2c core do that for us.

Platforms wishing to specify separate wakeup interrupt for the device
should use named interrupt syntax in their DTSes:

	interrupt-parent = &lt;&amp;intc1&gt;;
	interrupts = &lt;5 0&gt;, &lt;6 0&gt;;
	interrupt-names = "irq", "wakeup";

This patch is inspired by work done by Vignesh R &lt;vigneshr@ti.com&gt; for
pixcir_i2c_ts driver.

Note that the original code tried to preserve any existing wakeup
settings from userspace but was not quite right in that regard:
it would preserve wakeup flag set by userspace upon driver rebinding;
but it would re-arm the wakeup flag if it was disabled by userspace.

We think that resetting the flag upon re-binding the driver is proper
behavior as the driver is responsible for setting up and handling
wakeups.

Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Tested-by: Vignesh R &lt;vigneshr@ti.com&gt;
[wsa: updated the commit message]
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: core: Add support for best effort block read emulation</title>
<updated>2015-08-24T12:05:19Z</updated>
<author>
<name>Irina Tirdea</name>
</author>
<published>2015-08-12T14:31:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=01eef96e37d77cd89156e5f51aab81a9d5c96539'/>
<id>urn:sha1:01eef96e37d77cd89156e5f51aab81a9d5c96539</id>
<content type='text'>
There are devices that need to handle block transactions
regardless of the capabilities exported by the adapter.
For performance reasons, they need to use i2c read blocks
if available, otherwise emulate the block transaction with word
or byte transactions.

Add support for a helper function that would read a data block
using the best transfer available: I2C_FUNC_SMBUS_READ_I2C_BLOCK,
I2C_FUNC_SMBUS_READ_WORD_DATA or I2C_FUNC_SMBUS_READ_BYTE_DATA.

Signed-off-by: Irina Tirdea &lt;irina.tirdea@intel.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
</feed>
