From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AEC8C43603 for ; Sun, 15 Dec 2019 11:04:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 053FA20700 for ; Sun, 15 Dec 2019 11:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576407863; bh=jInH+Cq3OV6m+CItq6mXyi0zkmovCRFQw60b/mcp4T0=; h=Subject:To:Cc:From:Date:List-ID:From; b=mY2XmPEhYIPGiv6JYU76xHmJe+8uLMk2mq0k0Us+QNAWVhtF42FtDXsznJO/kVusS aCj5ejlfvSFPN54MiI48p1Yi/TNDUIU3+G5chHTSUODuYiUqS2iOsOGgLUHIwj2OJL ZA+zKGqBWfI1aIgNgwF72aEwYPsmmmgwYhvqk2E0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726094AbfLOLEW (ORCPT ); Sun, 15 Dec 2019 06:04:22 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:48133 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726083AbfLOLEW (ORCPT ); Sun, 15 Dec 2019 06:04:22 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 23DCC222C9; Sun, 15 Dec 2019 06:04:21 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 06:04:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=jQfaRj jHYgDQ6sNUAULCnhHnp19WL8tl/t4L+n2S+Hw=; b=ZaKIe1cp9dvfeFw26cHRzC X5V16eZ/KO08vqf+zTIHp7qZroO8KcjkwAvTbPQpsVMD1cyzUQmIYhPQfu3Oj+8F YNjvtmibYPwS0Tp7E3sbbQU1X6GF7OpqNk1806Dt1tVbmx6kPCfH0kMpYqk6T4qi Z9w7arjk/5euQBP9Kk2Ke03zn0afalNzjAJ3GXkg1ArNfQYgZ4tA9XTwdj6vwbUz n1UYIilSBPm0Y6GcNAaRGXuqezp0Fiwhmvb7z8x1F/h9iGElflGKBFgDalYWnQFH EV+oIxls6tB7xSJKujeNd5dUTwXmTlv+n2AtFRnkiQl6CypI0ut55djr7WjfjtHg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtfedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 0A7118005B; Sun, 15 Dec 2019 06:04:19 -0500 (EST) Subject: FAILED: patch "[PATCH] phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role"" failed to apply to 4.14-stable tree To: yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, kishon@ti.com, pavel@denx.de, stable@vger.kernel.org Cc: From: Date: Sun, 15 Dec 2019 12:04:16 +0100 Message-ID: <15764078564151@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 4bd5ead82d4b877ebe41daf95f28cda53205b039 Mon Sep 17 00:00:00 2001 From: Yoshihiro Shimoda 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(). Reported-by: Pavel Machek Fixes: 9bb86777fb71 ("phy: rcar-gen3-usb2: add sysfs for usb role swap") Cc: # v4.10+ Signed-off-by: Yoshihiro Shimoda Reviewed-by: Geert Uytterhoeven Acked-by: Pavel Machek Signed-off-by: Kishon Vijay Abraham I diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index 49ec67d46ccc..bfb22f868857 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -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;