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>
Wed, 19 Aug 2020 06:23:57 +0000 (08:23 +0200)
commitc7adb1632b3e7dc6686438c60758a6126c06cdbe
tree91cae423356b3baf639829434336f98968a665aa
parent03146f30ef0e3bd3b173435996f1175a3d89e02f
usb: core: fix quirks_param_set() writing to a const pointer

[ Upstream commit b1b6bed3b5036509b449b5965285d5057ba42527 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/core/quirks.c