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)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 12 Aug 2019 05:55:24 +0000 (08:55 +0300)
commit5dac665cf403967bb79a7aeb8c182a621fe617ff
treeebcd7dd86e25a663ac9264e4aa1edd0135b372a4
parentd45331b00ddb179e291766617259261c112db872
usb: gadget: udc: renesas_usb3: Fix sysfs interface of "role"

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>
drivers/usb/gadget/udc/renesas_usb3.c