public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: mark HostNotify target address as used
@ 2024-07-10  8:55 Wolfram Sang
  2024-07-10  9:15 ` Sergei Shtylyov
  2024-07-11  9:31 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Wolfram Sang @ 2024-07-10  8:55 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Pierre-Yves MORDRET, Alain Volmat, linux-i2c,
	linux-kernel

I2C core handles the local target for receiving HostNotify alerts. There
is no separate driver bound to that address. That means userspace can
access it if desired, leading to further complications if controllers
are not capable of reading their own local target. Bind the local target
to the dummy driver so it will marked as "handled by the kernel" if the
HostNotify feature is used. That protects aginst userspace access and
prevents other drivers binding to it.

Fixes: 2a71593da34d ("i2c: smbus: add core function handling SMBus host-notify")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/i2c-core-base.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index d6213d251336..57f03cbb1f48 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1067,6 +1067,7 @@ EXPORT_SYMBOL(i2c_find_device_by_fwnode);
 
 static const struct i2c_device_id dummy_id[] = {
 	{ "dummy" },
+	{ "smbus_host_notify" },
 	{ }
 };
 
-- 
2.43.0


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

* Re: [PATCH] i2c: mark HostNotify target address as used
  2024-07-10  8:55 [PATCH] i2c: mark HostNotify target address as used Wolfram Sang
@ 2024-07-10  9:15 ` Sergei Shtylyov
  2024-07-11  9:26   ` Wolfram Sang
  2024-07-11  9:31 ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2024-07-10  9:15 UTC (permalink / raw)
  To: Wolfram Sang, linux-renesas-soc
  Cc: Pierre-Yves MORDRET, Alain Volmat, linux-i2c, linux-kernel

On 7/10/24 11:55 AM, Wolfram Sang wrote:

> I2C core handles the local target for receiving HostNotify alerts. There
> is no separate driver bound to that address. That means userspace can
> access it if desired, leading to further complications if controllers
> are not capable of reading their own local target. Bind the local target
> to the dummy driver so it will marked as "handled by the kernel" if the
                                ^ be? :-)

> HostNotify feature is used. That protects aginst userspace access and
> prevents other drivers binding to it.
> 
> Fixes: 2a71593da34d ("i2c: smbus: add core function handling SMBus host-notify")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[...]

MBR, Sergey

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

* Re: [PATCH] i2c: mark HostNotify target address as used
  2024-07-10  9:15 ` Sergei Shtylyov
@ 2024-07-11  9:26   ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2024-07-11  9:26 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: linux-renesas-soc, Pierre-Yves MORDRET, Alain Volmat, linux-i2c,
	linux-kernel

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


> > to the dummy driver so it will marked as "handled by the kernel" if the
>                                 ^ be? :-)

Yes, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] i2c: mark HostNotify target address as used
  2024-07-10  8:55 [PATCH] i2c: mark HostNotify target address as used Wolfram Sang
  2024-07-10  9:15 ` Sergei Shtylyov
@ 2024-07-11  9:31 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2024-07-11  9:31 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Pierre-Yves MORDRET, Alain Volmat, linux-i2c, linux-kernel

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

On Wed, Jul 10, 2024 at 10:55:07AM +0200, Wolfram Sang wrote:
> I2C core handles the local target for receiving HostNotify alerts. There
> is no separate driver bound to that address. That means userspace can
> access it if desired, leading to further complications if controllers
> are not capable of reading their own local target. Bind the local target
> to the dummy driver so it will marked as "handled by the kernel" if the
> HostNotify feature is used. That protects aginst userspace access and
> prevents other drivers binding to it.
> 
> Fixes: 2a71593da34d ("i2c: smbus: add core function handling SMBus host-notify")
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Fixed the commit message, rebased to for-current and applied to
for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2024-07-11  9:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-10  8:55 [PATCH] i2c: mark HostNotify target address as used Wolfram Sang
2024-07-10  9:15 ` Sergei Shtylyov
2024-07-11  9:26   ` Wolfram Sang
2024-07-11  9:31 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox