linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter()
@ 2014-01-13 21:29 Stephen Warren
  2014-01-14 16:12 ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2014-01-13 21:29 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Stephen Warren, Phil Carmody, stable

From: Stephen Warren <swarren@nvidia.com>

The body of i2c_parent_is_i2c_adapter() is currently guarded by
CONFIG_I2C_MUX instead.

Among potentially other problems, this resulted in i2c_lock_adapter()
only locking I2C mux child adapters, and not the parent adapter. In
turn, this could allow inter-mingling of mux child selection and I2C
transactions, which could result in I2C transactions being directed to
the wrong I2C bus, and possibly even switching between busses in the
middle of a transaction.

One concrete issue caused by this bug was corrupted HDMI EDID reads
during boot on the NVIDIA Tegra Seaboard system, although this only
became apparent in recent linux-next, when the boot timing was changed
just enough to trigger the race condition.

Fixes: 3923172b3d70 ("i2c: reduce parent checking to a NOOP in non-I2C_MUX case")
Cc: Phil Carmody <phil.carmody@partner.samsung.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 include/linux/i2c.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index eff50e062be8..d9c8dbd3373f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -445,7 +445,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
 static inline struct i2c_adapter *
 i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
 {
-#if IS_ENABLED(I2C_MUX)
+#if IS_ENABLED(CONFIG_I2C_MUX)
 	struct device *parent = adapter->dev.parent;
 
 	if (parent != NULL && parent->type == &i2c_adapter_type)
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter()
  2014-01-13 21:29 [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter() Stephen Warren
@ 2014-01-14 16:12 ` Wolfram Sang
  2014-01-16 17:25   ` Stephen Warren
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2014-01-14 16:12 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-i2c, linux-kernel, Stephen Warren, Phil Carmody, stable

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

On Mon, Jan 13, 2014 at 02:29:04PM -0700, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> The body of i2c_parent_is_i2c_adapter() is currently guarded by
> CONFIG_I2C_MUX instead.

This paragraph sounds strange to me. I'll update it a little. After that
I'll go looking for a brown paper bag...

> Among potentially other problems, this resulted in i2c_lock_adapter()
> only locking I2C mux child adapters, and not the parent adapter. In
> turn, this could allow inter-mingling of mux child selection and I2C
> transactions, which could result in I2C transactions being directed to
> the wrong I2C bus, and possibly even switching between busses in the
> middle of a transaction.
> 
> One concrete issue caused by this bug was corrupted HDMI EDID reads
> during boot on the NVIDIA Tegra Seaboard system, although this only
> became apparent in recent linux-next, when the boot timing was changed
> just enough to trigger the race condition.
> 
> Fixes: 3923172b3d70 ("i2c: reduce parent checking to a NOOP in non-I2C_MUX case")
> Cc: Phil Carmody <phil.carmody@partner.samsung.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied to for-current, thanks for catching this one!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter()
  2014-01-14 16:12 ` Wolfram Sang
@ 2014-01-16 17:25   ` Stephen Warren
  2014-01-16 18:04     ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Warren @ 2014-01-16 17:25 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Stephen Warren, Phil Carmody, stable

On 01/14/2014 09:12 AM, Wolfram Sang wrote:
> On Mon, Jan 13, 2014 at 02:29:04PM -0700, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The body of i2c_parent_is_i2c_adapter() is currently guarded by
>> CONFIG_I2C_MUX instead.
> 
> This paragraph sounds strange to me. I'll update it a little. After that
> I'll go looking for a brown paper bag...
> 
>> Among potentially other problems, this resulted in i2c_lock_adapter()
>> only locking I2C mux child adapters, and not the parent adapter. In
>> turn, this could allow inter-mingling of mux child selection and I2C
>> transactions, which could result in I2C transactions being directed to
>> the wrong I2C bus, and possibly even switching between busses in the
>> middle of a transaction.
>>
>> One concrete issue caused by this bug was corrupted HDMI EDID reads
>> during boot on the NVIDIA Tegra Seaboard system, although this only
>> became apparent in recent linux-next, when the boot timing was changed
>> just enough to trigger the race condition.
>>
>> Fixes: 3923172b3d70 ("i2c: reduce parent checking to a NOOP in non-I2C_MUX case")
>> Cc: Phil Carmody <phil.carmody@partner.samsung.com>
>> Cc: <stable@vger.kernel.org>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> 
> Applied to for-current, thanks for catching this one!

I do see this in for-current, but it looks like that branch isn't part
of linux-next. Should it be, or perhaps for-current should be merged
into for-next?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter()
  2014-01-16 17:25   ` Stephen Warren
@ 2014-01-16 18:04     ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2014-01-16 18:04 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-i2c, linux-kernel, Stephen Warren, Phil Carmody, stable

[-- Attachment #1: Type: text/plain, Size: 187 bytes --]

> I do see this in for-current, but it looks like that branch isn't part
> of linux-next. Should it be, or perhaps for-current should be merged
> into for-next?

It is upstream already.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-16 18:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-13 21:29 [PATCH] i2c: Re-instate body of i2c_parent_is_i2c_adapter() Stephen Warren
2014-01-14 16:12 ` Wolfram Sang
2014-01-16 17:25   ` Stephen Warren
2014-01-16 18:04     ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).