Re: [PATCH v2] usb: core: fix quirks_param_set() writing to a const pointer

From: Greg Kroah-Hartman
Date: Tue Jul 07 2020 - 09:18:09 EST


On Tue, Jul 07, 2020 at 02:51:02PM +0200, Kars Mulder wrote:
> The function quirks_param_set() takes as argument a const char* pointer
> to the new value of the usbcore.quirks parameter. It then casts this
> pointer to a non-const char* pointer and passes it to the strsep()
> function, which overwrites the value.
>
> Fix this by creating a copy of the value using kstrdup() and letting
> that copy be written to by strsep().
>
> Fixes: 027bd6cafd9a ("usb: core: Add "quirks" parameter for usbcore")
> Signed-off-by: Kars Mulder <kerneldev@xxxxxxxxxxxxx>
>
> ---
> drivers/usb/core/quirks.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)

What changed from v1? Always put that below the --- line like the
documentation asks.

Please fix up and resend a v3.

thanks,

greg k-h