Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1176612pxb; Fri, 1 Apr 2022 06:42:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZCD6aJ0VUnMY/e4FAZIvtnQk7onW172VcWIKdJEubMaBzLkqG7y87dU1mLvas1sqea5wH X-Received: by 2002:a17:907:7205:b0:6df:b8c9:e68e with SMTP id dr5-20020a170907720500b006dfb8c9e68emr9360344ejc.507.1648820529718; Fri, 01 Apr 2022 06:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648820529; cv=none; d=google.com; s=arc-20160816; b=nwWGW5x2VO9yuI0TL9QWp7Bk/tzCIOkNv+D9RfkpFKJ8bPGY338ajAAAIduqNfG692 4Ur8JjswvB60Xsk1P4MFLq+t8CxtFEBYD052HOg3i0t+ttWvmOUq3xpmL0BgJoF8xD+5 CEXHvSi8nFZmf8ubjpO9v9gfTpXn34ONCnxy6mLP9i6f8xNGR4yBm2ySIzwJiFspLW4M JCdPdv7gfElkATg32kcY74mDAQsotfNB1Z3bLLewFWga4QvFCHU/tsCxj5Wry2UDJSHX q4i0NqwihQ8vDOMYu7ubJp3fYmo3NCwKoFYrgbL0CajnFZJ33vjm5Lg9JJlYxCS5VA/F DKVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ul9Nn0cFxeqfA+iiunXaE5VnnLLe1kXEByhNvjJBcls=; b=BL+IeR2pSfiHSwiPjg7bTsfV4PJXafptEtzYHNq2wqhBLzOk3wmViUKbOTJUnAfaaj QsOReqGbtRR8TqIfdekVxUPqPYgJvF45IMmiSS3ROJH78P6pWQpmve9F8h2d2PYw3n3k Jt4nS65E+Dy4PX/LHSEv15xCUYkQkuUPGgdmpLLv9p8c7AYAgEDl++ci2rWBWwZaF7Rv 3FeYuxuX0ru8ypMad7gvMUaL13FRSiTAf8YUXVVzBvON/XzCc71TSIWjcTs9ZaMhJYUU Iik0tI72OiYiRfCpgEm9/JmS4rkZDpyw+RmTxLiRY1YUWQ9lnjedgNpfNNB9zi7prxnU cxOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p3O0Yr20; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kt6-20020a170906aac600b006df76385d3fsi1556048ejb.479.2022.04.01.06.41.42; Fri, 01 Apr 2022 06:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p3O0Yr20; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240335AbiCaQ73 (ORCPT + 99 others); Thu, 31 Mar 2022 12:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232806AbiCaQ72 (ORCPT ); Thu, 31 Mar 2022 12:59:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24D84232128; Thu, 31 Mar 2022 09:57:41 -0700 (PDT) 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 B41F26130D; Thu, 31 Mar 2022 16:57:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFCB4C340ED; Thu, 31 Mar 2022 16:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648745860; bh=igvAvAQeyELaJZGiURaidLDfiJ9bucjWU0/u3Bx78+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p3O0Yr20Zzryj9CMPn8goSqUTEYcrdwH6a6P5RDADVxSPMC98mi/YN7wftGRziKly O9K34sVHKNIzfHOAD1dmmTA/HfiWHaLEg8rXwFrtNwpa2JELbHmfSBxdCmDGUzkmoA AP90rl1S+qDeytxkanfeH5ahB2Wy23kxqLW8kX1Y= Date: Thu, 31 Mar 2022 18:57:37 +0200 From: Greg KH To: Benson Leung Cc: Heikki Krogerus , Won Chung , Tomas Winkler , Mika Westerberg , Benson Leung , Prashant Malani , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v3] misc/mei: Add NULL check to component match callback functions Message-ID: References: <20220331084918.2592699-1-wonchung@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Thu, Mar 31, 2022 at 09:04:59AM -0700, Benson Leung wrote: > Hi Greg, > > On Thu, Mar 31, 2022 at 01:38:02PM +0200, Greg KH wrote: > > > > > return 0; > > > > > > > > > > diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c > > > > > index f7380d387bab..e32a81da8af6 100644 > > > > > --- a/drivers/misc/mei/pxp/mei_pxp.c > > > > > +++ b/drivers/misc/mei/pxp/mei_pxp.c > > > > > @@ -131,7 +131,7 @@ static int mei_pxp_component_match(struct device *dev, int subcomponent, > > > > > { > > > > > struct device *base = data; > > > > > > > > > > - if (strcmp(dev->driver->name, "i915") || > > > > > + if (!base || !dev->driver || strcmp(dev->driver->name, "i915") || > > > > > > > > Same here, shouldn't this be caught by the driver core or bus and match > > > > should not be called? > > > > > > > > Why not fix this in the component/driver core instead? > > > > > > A component is just a device that is declared to be a "component", and > > > the code that declares it as component does not have to be the driver > > > of that device. You simply can't assume that it's bind to a driver > > > like this function does. > > > > > > In our case the "components" are USB ports, so devices that are never > > > bind to drivers. > > > > And going off of the driver name is sane? That feels ripe for bugs and > > problems in the future, but hey, I don't understand the need for this > > driver to care about another driver at all. > > I think the component framework is meant to be this loose confederation of > devices, so going into component match, you don't know what the other device > is yet. > > The USB drivers and the i915 drivers 100% don't care about each other, > but the framework doesn't know that yet until all the drivers try to match. > > > > > And why is a USB device being passed to something that it thinks is a > > PCI device? That too feels really wrong and ripe for problems. > > > > The problematic device that's being passed through here is actually the > usb4_port, not a usb device. My guess would be that's why it's getting past any > checks for whether it's a PCI device. a usb4 port should not be a pci device. So fix up the checks, don't do a random "is this the driver name?" check, look for the real driver pointer or something like that that you KNOW is the correct match. > The component framework currently being used by (hdac_i915, mei_hdcp, mei_pxp) > to connect those three devices together, and completely separately, the > component framework is being used by the typec connector class's port mapper. > > These two clusters of devices are using the same component framework, but are > not supposed to interact with each other. When we attempted to add the usb4_port > and its retimer in order to link tbt/usb4 to the typec connector, we discovered > this interaction because we happened to build the usb4_port built-in in our > configs, so it does its component_add earlier. > > I agree, by the way. This is all a bit ugly. Something is wrong with the component code here if this is happening, as that's not a solid interface that can actually work at all. Perhaps do not use this framework until it is fixed? And again, is this something that you see today on an unmodified 5.17.1 release? If not, why all of the stable backport requests? confused, greg k-h