Re: [PATCH v2 1/2] USB: make to_usb_driver() use container_of_const()
From: Doug Anderson
Date: Thu Nov 14 2024 - 17:39:14 EST
Hi,
On Wed, Nov 13, 2024 at 6:04 AM Greg Kroah-Hartman
<gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Turns out that we have some const pointers being passed to
> to_usb_driver() but were not catching this. Change the macro to
> properly propagate the const-ness of the pointer so that we will notice
> when we try to write to memory that we shouldn't be writing to.
>
> This requires fixing up the usb_match_dynamic_id() function as well,
> because it can handle a const * to struct usb_driver.
>
> Cc: Johan Hovold <johan@xxxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: Grant Grundler <grundler@xxxxxxxxxxxx>
> Cc: Yajun Deng <yajun.deng@xxxxxxxxx>
> Cc: Oliver Neukum <oneukum@xxxxxxxx>
> Cc: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
> v2: reordered patches, goes on top of series submitted at https://lore.kernel.org/r/2024111322-kindly-finalist-d247@gregkh
>
> drivers/usb/core/driver.c | 4 ++--
> include/linux/usb.h | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
This looks reasonable to me. Assuming that there are no compiler
errors reported:
Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>