Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp860680pxb; Tue, 1 Feb 2022 11:58:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGn9r01VyrGA1ltWnQ/pW726zTYw7kukQCyI/Q5/MbJJghZIOYX6TMJqcJnoYsMLm47aIe X-Received: by 2002:a05:6402:5107:: with SMTP id m7mr26935312edd.408.1643745482830; Tue, 01 Feb 2022 11:58:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745482; cv=none; d=google.com; s=arc-20160816; b=nfmeMtjOT6Rda0e5TEa1AZYDwBWuNO949LeSCLeXhNxCXx6PFbK1K1solUJ6DrTeD+ 74Yc0y9Q47jPNpBGln5HtJck4ZBSdZyfYxWc/MsCpg6LQelXL07sl4/WKH6HlmgJ22MR fi9wYYIp+OKwgUnmo1mW92dOgCgx6ErQK51K4M3C/1WkLhsraPBcO/reoz/453hZ7RNI +c6lvWi77Fnn3NAWvUPX7bpDqs+tG7+Jzb8T+RWnQK/BVVq0uz76hYFbjILxIxAslIaz oAXpCA+Cl3+BrxoTJr4L3bIicvlbIlH3kpKQmeo8f2NxgDl7u9a8ZUjpEPvX2jdwxwab 3/iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qClFTAst5V5oifCk8aP6DyTweGc2wYz+H/n0PqCKHT0=; b=sH2UIjOs3iNCcJ+D77GqEUCpKCV3KAdiEqPm4MOUtsDWzcAN6aos4Q7zABRx6f5xYo aMW1BqWIvtmDhaG7dDKRTyiQqOoQrhu14TUVhj71jsAyJnQRlahWxaI0Se0Wv7EcusIx mR+Yl/XVbR0QJVrQFFHxn/73Sv651b+36AUiIiTJ95HajM7w7GVZrPe9aVbO2fuW1T7V 2/BOsSb5HyqJkYU7a+XFjN4GRP+oLtuoHyGTz2tOSemtyqVF1L+nZCq1VjNfQWYgBLvF ylsA9ug2Dix11G80GbL0npbZ5WqwvD8f9mZoPQXTT2FwORPnw5ogn3dca/jKy3lA1n9a nKDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SQIfzgZ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si9550410edr.532.2022.02.01.11.57.37; Tue, 01 Feb 2022 11:58:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SQIfzgZ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359389AbiAaLFX (ORCPT + 99 others); Mon, 31 Jan 2022 06:05:23 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:36816 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359005AbiAaLCq (ORCPT ); Mon, 31 Jan 2022 06:02:46 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C24A60E83; Mon, 31 Jan 2022 11:02:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ECD0C340E8; Mon, 31 Jan 2022 11:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643626965; bh=41Bn7dpcwKdRVGJAeUT3KkBCidaikRKvL17gJkZ77QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQIfzgZ3rsCp8PcEzdR7sWL0ts67NtxpafoVVBM0X0/d8N+hgB2Qs4Rqgndxh/QqU 4dyMGS9sMks061sM7MWr5FXQxYRNAAICTRUqI1v3B+EaEXBAw9b16sqnPX2Yz0/+QX RzFJ5jOsNvY5AMUAMxE1z8hWU1ZNUyMx7N6RdTZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Hunter Subject: [PATCH 5.10 030/100] usb: common: ulpi: Fix crash in ulpi_match() Date: Mon, 31 Jan 2022 11:55:51 +0100 Message-Id: <20220131105221.467057676@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jon Hunter commit 2e3dd4a6246945bf84ea6f478365d116e661554c upstream. Commit 7495af930835 ("ARM: multi_v7_defconfig: Enable drivers for DragonBoard 410c") enables the CONFIG_PHY_QCOM_USB_HS for the ARM multi_v7_defconfig. Enabling this Kconfig is causing the kernel to crash on the Tegra20 Ventana platform in the ulpi_match() function. The Qualcomm USB HS PHY driver that is enabled by CONFIG_PHY_QCOM_USB_HS, registers a ulpi_driver but this driver does not provide an 'id_table', so when ulpi_match() is called on the Tegra20 Ventana platform, it crashes when attempting to deference the id_table pointer which is not valid. The Qualcomm USB HS PHY driver uses device-tree for matching the ULPI driver with the device and so fix this crash by using device-tree for matching if the id_table is not valid. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Cc: stable Signed-off-by: Jon Hunter Link: https://lore.kernel.org/r/20220117150039.44058-1-jonathanh@nvidia.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/common/ulpi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -39,8 +39,11 @@ static int ulpi_match(struct device *dev struct ulpi *ulpi = to_ulpi_dev(dev); const struct ulpi_device_id *id; - /* Some ULPI devices don't have a vendor id so rely on OF match */ - if (ulpi->id.vendor == 0) + /* + * Some ULPI devices don't have a vendor id + * or provide an id_table so rely on OF match. + */ + if (ulpi->id.vendor == 0 || !drv->id_table) return of_driver_match_device(dev, driver); for (id = drv->id_table; id->vendor; id++)