Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1688827pxb; Wed, 9 Feb 2022 02:14:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwROXf2OfIFrgVKUUISxyfp3E8jNW7l0m3ZrurE8W+U9An5uYH/Duu/yu1rzJCKm6/kBFqT X-Received: by 2002:a63:e643:: with SMTP id p3mr1287029pgj.7.1644401686315; Wed, 09 Feb 2022 02:14:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644401686; cv=none; d=google.com; s=arc-20160816; b=NPm3t+yXW7aQDrC0Qms9lAkGt7drfBVNEYqr1fNJO5wgOvQvlsNRyn0iun+bzbe/Se wRqaNgXIZsj4tYqNucpztSKx2V5d/NdBHUAsrxx5W7oem8G9qVqRcQWr2rgaB7apEIu6 ylVS72UIK15MBgXf/WCR8UXTEM28A91h+oU62PxweDyOdf9RYsDcxuAy0iO710JGiqT9 E2jHkWO78kgFOQnPxiHNG5moF3ttSZist9+QrPrjy4ZkWBWdZgrcxeMpQ6tYo/Yv9voe 0ud0mBUOo0SZsu3XjplRR4xXzh0FcWuu2B9A7KfS4lnzXnzCIuaoxhz3dStV1PdQXrSV 0j1A== 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=m1l5kQFS9+wbk3BCYeUsa5szSgA6assgVdE1o55vmpxtxEZ+CMp6o0Rz5Yk9wcEJ6M zPjlbtdiM2bZ3MPRgp5OIqz3SZXrrn33Cxz9JDZro/hHly4KTklcF5dJiEsi5ZKms07P 1P+XxTe2IRERWCoz8JcGiiihRNrj34xAL/p+KaRxk2UmMmNbL7UM350qP5lYNP/tdCu4 JhyVRHDfAEQz6xA9pSW0jmM6+pKJvSplPwUKUuFOrQ8Mq9qIt09mTXqYDQqlSTEEXxGV MUdz4UhV9w96N+RrFoQ7xVvptBApGt+LwwqyAUpN0uz1kW27OEF9z+ocnPd25kk/wsbI KXCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Q/LuXbei"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j71si4531511pgd.8.2022.02.09.02.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:14:46 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Q/LuXbei"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E720CE04AD94; Wed, 9 Feb 2022 01:16:32 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382503AbiBGLTZ (ORCPT + 99 others); Mon, 7 Feb 2022 06:19:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358828AbiBGLOp (ORCPT ); Mon, 7 Feb 2022 06:14:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E229AC0401E2; Mon, 7 Feb 2022 03:14:27 -0800 (PST) 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 D79FB61314; Mon, 7 Feb 2022 11:14:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC878C004E1; Mon, 7 Feb 2022 11:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644232452; bh=41Bn7dpcwKdRVGJAeUT3KkBCidaikRKvL17gJkZ77QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q/LuXbeiUy6Al3WDahQfzypVBFL++yOLzEC49PcmRp9g2DRoc50APPXVJao5DJm3d jYxIZt9foqLqGzQa45SVydbowbv+DL8rti43Qy5FWasaLBnDYCg9bMie7N5v2/BtnU m2hB3VedQkdDlkxJ01DcMNIFtd9dX8W427bR375w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Hunter Subject: [PATCH 4.19 14/86] usb: common: ulpi: Fix crash in ulpi_match() Date: Mon, 7 Feb 2022 12:05:37 +0100 Message-Id: <20220207103758.026314966@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103757.550973048@linuxfoundation.org> References: <20220207103757.550973048@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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++)