All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core
@ 2022-02-04 15:17 Andy Shevchenko
  2022-02-18 14:22 ` Wolfram Sang
  2022-02-21  9:56 ` Johan Hovold
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-02-04 15:17 UTC (permalink / raw)
  To: Johan Hovold, linux-i2c, linux-kernel
  Cc: Wolfram Sang, Andy Shevchenko, syzbot+0591ccf54ee05344e4eb

I2C core might use parent device to retrieve properties of
the controller. Propagate parent device for that.

Fixes: 83e53a8f120f ("i2c: Add bus driver for for OSIF USB i2c device.")
Reported-by: syzbot+0591ccf54ee05344e4eb@syzkaller.appspotmail.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-robotfuzz-osif.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
index 66dfa211e736..bfbfa0d07bb2 100644
--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
+++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
@@ -128,6 +128,7 @@ MODULE_DEVICE_TABLE(usb, osif_table);
 static int osif_probe(struct usb_interface *interface,
 			     const struct usb_device_id *id)
 {
+	struct device *dev = &interface->dev;
 	int ret;
 	struct osif_priv *priv;
 	u16 version;
@@ -145,6 +146,7 @@ static int osif_probe(struct usb_interface *interface,
 	priv->adapter.class = I2C_CLASS_HWMON;
 	priv->adapter.algo = &osif_algorithm;
 	priv->adapter.algo_data = priv;
+	priv->adapter.dev.parent = dev;
 	snprintf(priv->adapter.name, sizeof(priv->adapter.name),
 		 "OSIF at bus %03d device %03d",
 		 priv->usb_dev->bus->busnum, priv->usb_dev->devnum);
-- 
2.34.1


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

* Re: [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core
  2022-02-04 15:17 [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core Andy Shevchenko
@ 2022-02-18 14:22 ` Wolfram Sang
  2022-02-20 10:57   ` Andy Shevchenko
  2022-02-21  9:56 ` Johan Hovold
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2022-02-18 14:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Johan Hovold, linux-i2c, linux-kernel, syzbot+0591ccf54ee05344e4eb

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


> +	struct device *dev = &interface->dev;

This now creates a mixture of 'dev' and '&interface->dev'...

> +	priv->adapter.dev.parent = dev;

I propose to use &interface->dev here in this patch and convert to dev
in a later patch?


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

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

* Re: [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core
  2022-02-18 14:22 ` Wolfram Sang
@ 2022-02-20 10:57   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-02-20 10:57 UTC (permalink / raw)
  To: Wolfram Sang, Johan Hovold, linux-i2c, linux-kernel,
	syzbot+0591ccf54ee05344e4eb

On Fri, Feb 18, 2022 at 03:22:19PM +0100, Wolfram Sang wrote:
> 
> > +	struct device *dev = &interface->dev;
> 
> This now creates a mixture of 'dev' and '&interface->dev'...
> 
> > +	priv->adapter.dev.parent = dev;
> 
> I propose to use &interface->dev here in this patch and convert to dev
> in a later patch?

Why not?
Will do for next version (next week).

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core
  2022-02-04 15:17 [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core Andy Shevchenko
  2022-02-18 14:22 ` Wolfram Sang
@ 2022-02-21  9:56 ` Johan Hovold
  2022-02-21 18:40   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2022-02-21  9:56 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-i2c, linux-kernel, Wolfram Sang, syzbot+0591ccf54ee05344e4eb

On Fri, Feb 04, 2022 at 05:17:26PM +0200, Andy Shevchenko wrote:
> I2C core might use parent device to retrieve properties of
> the controller. Propagate parent device for that.

What is the problem you're trying to solve here?

If you've changed some core function so that the kernel crashes because
of this, you need to address this in core.

Looks like you're also changing the device topology with this change.

This needs more details.

> Fixes: 83e53a8f120f ("i2c: Add bus driver for for OSIF USB i2c device.")

This isn't the commit causing the NULL deref.

> Reported-by: syzbot+0591ccf54ee05344e4eb@syzkaller.appspotmail.com
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/i2c/busses/i2c-robotfuzz-osif.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
> index 66dfa211e736..bfbfa0d07bb2 100644
> --- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
> +++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
> @@ -128,6 +128,7 @@ MODULE_DEVICE_TABLE(usb, osif_table);
>  static int osif_probe(struct usb_interface *interface,
>  			     const struct usb_device_id *id)
>  {
> +	struct device *dev = &interface->dev;
>  	int ret;
>  	struct osif_priv *priv;
>  	u16 version;
> @@ -145,6 +146,7 @@ static int osif_probe(struct usb_interface *interface,
>  	priv->adapter.class = I2C_CLASS_HWMON;
>  	priv->adapter.algo = &osif_algorithm;
>  	priv->adapter.algo_data = priv;
> +	priv->adapter.dev.parent = dev;
>  	snprintf(priv->adapter.name, sizeof(priv->adapter.name),
>  		 "OSIF at bus %03d device %03d",
>  		 priv->usb_dev->bus->busnum, priv->usb_dev->devnum);

Johan

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

* Re: [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core
  2022-02-21  9:56 ` Johan Hovold
@ 2022-02-21 18:40   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2022-02-21 18:40 UTC (permalink / raw)
  To: Johan Hovold
  Cc: linux-i2c, linux-kernel, Wolfram Sang, syzbot+0591ccf54ee05344e4eb

On Mon, Feb 21, 2022 at 10:56:20AM +0100, Johan Hovold wrote:
> On Fri, Feb 04, 2022 at 05:17:26PM +0200, Andy Shevchenko wrote:
> > I2C core might use parent device to retrieve properties of
> > the controller. Propagate parent device for that.
> 
> What is the problem you're trying to solve here?

Okay, let's drop the patch.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2022-02-21 18:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 15:17 [PATCH v1 1/1] i2c: robotfuzz-osif: Propagate parent device to I2C core Andy Shevchenko
2022-02-18 14:22 ` Wolfram Sang
2022-02-20 10:57   ` Andy Shevchenko
2022-02-21  9:56 ` Johan Hovold
2022-02-21 18:40   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.