diff mbox series

i2c: mark HostNotify target address as used

Message ID 20240710085506.31267-2-wsa+renesas@sang-engineering.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show
Series i2c: mark HostNotify target address as used | expand

Commit Message

Wolfram Sang July 10, 2024, 8:55 a.m. UTC
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(+)

Comments

Sergey Shtylyov July 10, 2024, 9:15 a.m. UTC | #1
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
Wolfram Sang July 11, 2024, 9:26 a.m. UTC | #2
> > to the dummy driver so it will marked as "handled by the kernel" if the
>                                 ^ be? :-)

Yes, thanks!
Wolfram Sang July 11, 2024, 9:31 a.m. UTC | #3
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!
diff mbox series

Patch

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" },
 	{ }
 };