usb: core: fix quirks_param_set() writing to a const pointer
authorKars Mulder <kerneldev@karsmulder.nl>
Tue, 7 Jul 2020 14:43:50 +0000 (16:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jul 2020 11:38:21 +0000 (13:38 +0200)
commitb1b6bed3b5036509b449b5965285d5057ba42527
treea5ec20ab8fe703f05bbf7c43a178894d0826fe07
parent306c54d0edb6ba94d39877524dddebaad7770cf2
usb: core: fix quirks_param_set() writing to a const pointer

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@karsmulder.nl>
Link: https://lore.kernel.org/r/5ee2-5f048a00-21-618c5c00@230659773
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/quirks.c