]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
usb: gadget: udc: renesas_usb3: Fix sysfs interface of "role"
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Wed, 31 Jul 2019 10:15:43 +0000 (19:15 +0900)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 4 Sep 2019 06:16:38 +0000 (02:16 -0400)
commitf5bb8533d00e326776cc8fbb0f3a5858a50e73f8
tree0594175de4e47600f9e155ac02a17c6730bfc0c6
parenta0ba03bdd08ec211d84418856350be035aff5653
usb: gadget: udc: renesas_usb3: Fix sysfs interface of "role"

BugLink: https://bugs.launchpad.net/bugs/1841652
commit 5dac665cf403967bb79a7aeb8c182a621fe617ff upstream.

Since the role_store() uses strncmp(), it's possible to refer
out-of-memory if the sysfs data size is smaller than strlen("host").
This patch fixes it by using sysfs_streq() instead of strncmp().

Fixes: cc995c9ec118 ("usb: gadget: udc: renesas_usb3: add support for usb role swap")
Cc: <stable@vger.kernel.org> # v4.12+
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/usb/gadget/udc/renesas_usb3.c