Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Hongren Zheng <i@zenithal.me>
Cc: Shuah Khan <shuah@kernel.org>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	sfr@canb.auug.org.au
Subject: Re: [PATCH v2 -next] usb/usbip: fix wrong data added to platform device
Date: Mon, 16 Oct 2023 19:42:45 +0200	[thread overview]
Message-ID: <2023101623-amaretto-sevenfold-6b5e@gregkh> (raw)
In-Reply-To: <ZSpHPCaQ5DDA9Ysl@Sun>

On Sat, Oct 14, 2023 at 03:46:04PM +0800, Hongren Zheng wrote:
> .data of platform_device_info will be copied into .platform_data of
> struct device via platform_device_add_data.

That is crazy.

> However, vhcis[i] contains a spinlock, is dynamically allocated and
> used by other code, so it is not meant to be copied. The workaround
> was to use void *vhci as an agent, but it was removed in the commit
> suggested below.

Again, crazy, I'm amazed it works at all.

> This patch adds back the workaround and changes the way of using
> platform_data accordingly.
> 
> Reported-by: syzbot+e0dbc33630a092ccf033@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/r/00000000000029242706077f3145@google.com/
> Reported-by: syzbot+6867a9777f4b8dc4e256@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/r/0000000000007634c1060793197c@google.com/
> Fixes: b8aaf639b403 ("usbip: Use platform_device_register_full()")
> Tested-by: syzbot+6867a9777f4b8dc4e256@syzkaller.appspotmail.com
> Link: https://lore.kernel.org/r/0000000000007ac87d0607979b6b@google.com/
> Signed-off-by: Hongren Zheng <i@zenithal.me>
> ---
>  drivers/usb/usbip/vhci_hcd.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)

I'll take this now, as it fixes a reported issue, but really, the root
problem should be fixed instead.  This is not how to treat platform data
at all.

thanks,

greg k-h

      parent reply	other threads:[~2023-10-16 17:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-14  7:46 [PATCH v2 -next] usb/usbip: fix wrong data added to platform device Hongren Zheng
2023-10-16  7:40 ` Andy Shevchenko
2023-10-16 17:19   ` Shuah Khan
2023-10-16 17:42 ` Greg Kroah-Hartman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2023101623-amaretto-sevenfold-6b5e@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=i@zenithal.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox