phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role"
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Mon, 7 Oct 2019 07:55:10 +0000 (16:55 +0900)
committerKishon Vijay Abraham I <kishon@ti.com>
Wed, 23 Oct 2019 07:50:37 +0000 (13:20 +0530)
commit4bd5ead82d4b877ebe41daf95f28cda53205b039
tree72a5000f8cb392f354387e6301dac5c819bd05a0
parenta8a24429dd1d799f1c6737779af88c1d39290a77
phy: renesas: rcar-gen3-usb2: 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().

Reported-by: Pavel Machek <pavel@denx.de>
Fixes: 9bb86777fb71 ("phy: rcar-gen3-usb2: add sysfs for usb role swap")
Cc: <stable@vger.kernel.org> # v4.10+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/phy/renesas/phy-rcar-gen3-usb2.c