Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2748432imj; Mon, 11 Feb 2019 07:55:23 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibv98y1ywycEsOwuPgaRgc01jlI2nFKf7CRjq0a9eXCWHWDRVkdGSLMAYDHHB63Pyj2wTjq X-Received: by 2002:a17:902:d83:: with SMTP id 3mr37460329plv.43.1549900523114; Mon, 11 Feb 2019 07:55:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900523; cv=none; d=google.com; s=arc-20160816; b=oqq3F/up1EAXo+wFmInA16eXyQOzDDgS6VyChk5bQkt/o1GDtDTHUxHcD4Iw6rfh1w OgFRZo13W3n9QZwCh6zJFOCY8aZEXRRQHTIxi5STiI8zab3YGzqn7Wdr8Vgf/7lNEB/O NdyZIlp1BN+Yj3UIEZfCvyBsAdLgWNRDnUqMJK0T0oK8bfGZm6Ba1TWX6urRoH64IG9K S3SHd82yQNOciW7ruDLNUxPXyNT9ZxKMm6NLod5rKYFrHKS5NJD1YRSvqjrodEj1NISM 1hSFxPG6CA5qhKPTzypJxAHyrGapdHFUN4TBKmhodx7cVkONqubYKMdgJHnXJwt3YEcR paTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t0oLqTydO9QTzMsh5mobkc9TZltV2FYjN/U5/0D+eb4=; b=yxptC0Y/AuM9u01RkdqEU2k4boxQQPB5N9yLH/aWSww7l+ezot+dskDf8nKuDDW4pb c43a4+katjhTq+s9mKFvq7Vi1vgAkJwVYa0II0+fo/yVYO7GPmC4Tf64VzWxHANXoQl+ 4NAcHJ0JvtXLhOwm2p+U75Gwm9JCr5gz/WqAw7UEos4uMNaZ95Tw5AHpquLIMUBX8pky +h22DYZoldYraY6QXvDq9Z3LxlhJ6wARfmm4PM8ndGyoYSpc0EWKuz/aHGugc0lOjBLc s7ezDpTuZEpvXmllVYcsctEiu9WyaOSfsqXjEIff8Cw1YtQoZJesXbqc1CmSwyZHUzXz 5ktg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=thyhgax1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h17si9961308pgh.495.2019.02.11.07.55.06; Mon, 11 Feb 2019 07:55:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=thyhgax1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731412AbfBKPw7 (ORCPT + 99 others); Mon, 11 Feb 2019 10:52:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:46146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729891AbfBKOgx (ORCPT ); Mon, 11 Feb 2019 09:36:53 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C16C2081B; Mon, 11 Feb 2019 14:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895813; bh=6ONwM5jc09VvTP0hGZEfUBlta5HYtxspVyFlDlbYsz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=thyhgax1vD+si98cV9Y4oi4+ZT5ek7dgDktPGLbIDZ9g7UCpWpvL2asYAfbrurbok On20U7NrB3QxBx6ZAzMIwW/uJxsmNnZUjoIdZVe/nCf1isBHcoMwJ7LP2p4nsoFet8 pVsf2K/xE94+b/s4EDRSOhsfN+tDUUw/nev71LtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bin Liu , Felipe Balbi Subject: [PATCH 4.20 331/352] usb: phy: am335x: fix race condition in _probe Date: Mon, 11 Feb 2019 15:19:18 +0100 Message-Id: <20190211141908.003076691@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bin Liu commit a53469a68eb886e84dd8b69a1458a623d3591793 upstream. power off the phy should be done before populate the phy. Otherwise, am335x_init() could be called by the phy owner to power on the phy first, then am335x_phy_probe() turns off the phy again without the caller knowing it. Fixes: 2fc711d76352 ("usb: phy: am335x: Enable USB remote wakeup using PHY wakeup") Cc: stable@vger.kernel.org # v3.18+ Signed-off-by: Bin Liu Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/phy/phy-am335x.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/usb/phy/phy-am335x.c +++ b/drivers/usb/phy/phy-am335x.c @@ -61,9 +61,6 @@ static int am335x_phy_probe(struct platf if (ret) return ret; - ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy); - if (ret) - return ret; am_phy->usb_phy_gen.phy.init = am335x_init; am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown; @@ -82,7 +79,7 @@ static int am335x_phy_probe(struct platf device_set_wakeup_enable(dev, false); phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false); - return 0; + return usb_add_phy_dev(&am_phy->usb_phy_gen.phy); } static int am335x_phy_remove(struct platform_device *pdev)