FAILED: patch "[PATCH] phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role"" failed to apply to 4.14-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 4bd5ead82d4b877ebe41daf95f28cda53205b039 Mon Sep 17 00:00:00 2001
From: Yoshihiro Shimoda <[email protected]>
Date: Mon, 7 Oct 2019 16:55:10 +0900
Subject: [PATCH] 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().
drivers/phy/renesas/phy-rcar-gen3-usb2.c +3 -2
@@ -21,6 +21,7 @@#include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/regulator/consumer.h> +#include <linux/string.h> #include <linux/usb/of.h> #include <linux/workqueue.h>
@@ -320,9 +321,9 @@ static ssize_t role_store(struct device *dev, struct device_attribute *attr,if (!ch->is_otg_channel || !rcar_gen3_is_any_rphy_initialized (ch))return -EIO ; -if (!strncmp (buf,"host" ,strlen ("host" ))) +if (sysfs_streq (buf,"host" )) new_mode =PHY_MODE_USB_HOST ; -else if (!strncmp (buf,"peripheral" ,strlen ("peripheral" ))) +else if (sysfs_streq (buf,"peripheral" )) new_mode =PHY_MODE_USB_DEVICE ;else return -EINVAL ;
Sasha Levin
maintainerQuoted 21 lines · On Sun, Dec 15, 2019 at 12:04:16PM +0100, [email protected] wrote:
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
4bd5ead82d4b877ebe41daf95f28cda53205b039Mon Sep 17 00:00:00 2001
From: Yoshihiro Shimoda <[email protected]>
Date: Mon, 7 Oct 2019 16:55:10 +0900
Subject: [PATCH] phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role"Since the
role_store()usesstrncmp(), it's possible to refer out-of-memory if the sysfs data size is smaller thanstrlen("host"). This patch fixes it by usingsysfs_streq()instead ofstrncmp().
Quoted 7 lines
Reported-by Pavel Machek <[email protected]>Fixes 9bb86777fb71 ("phy: rcar-gen3-usb2: add sysfs for usb role swap")Cc <[email protected]> # v4.10+Signed-off-by Yoshihiro Shimoda <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>Acked-by Pavel Machek <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>
Adjusted context and queued up for 4.14.
Signature · 2 lines
Thanks, Sasha