Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2520251pxb; Sun, 3 Apr 2022 09:47:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXgtJvASjrx6tkpb5cWZyGtqrxy3iMsAmgqjtdI9iBPh7//PTpfa37Ss7UZL6melGsgOCn X-Received: by 2002:a63:5145:0:b0:381:4051:1f5a with SMTP id r5-20020a635145000000b0038140511f5amr23318400pgl.300.1649004425945; Sun, 03 Apr 2022 09:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649004425; cv=none; d=google.com; s=arc-20160816; b=tiWQ5eHXuP6lJhhdFy8JXUczl6NRLvq3eRg0l3J9ttOVX5UxYFxSIusjz3gYhqGs14 ONooDvvqDHwTWCPxY9Yrf/5gvKNt4WaqbIgOSwyT0SGlFlmm9dAj/TcIlDbfA//dzROm zGsuwZ3yBICtl3o6H8JGMs2Is1UiuB/fYS046qYHd0iGizXZkrxyBHdMFu6e8I+SKNAr x8GiKhAoK22Zfbga5hw6LQXXcMEI6wt9rThS9cgucNkkO8hI1SZeL7QAKOgt9KM5ntoE 2l0G/K3kYZ1clQpiKEcE3eDPBBF0YAQD7ZWnOiGpYuI+XHUjsg+HFbWRqdsQqL+zKac6 S4AA== 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=MO0/ty9ybQF1qACMJmOXTuFnMpYGfOx5VnnNgcY+e9Q=; b=jWQAV1JBPHBqPbh/M3QxbAmS717d6ZnM1sHqvaiNFf8uwGKE9z15GtnPYZEcZWZnGq FT7H5yTh9k1EGpALNphhE7OvZIY7OXc5cWVMbcy8cZ0aTmf3AeqCI00tyHGx3/xO0ZEa PYU/KNlKdxX7R/vFPdaRbQvwsolyAlquoXup0j0IAJO2GysEjh/zCz4JLR1Ch6MSrWsT 9HMTv/o2+cpnPG2s0jOFEDdlcuiHPcN4T5YnWWBdtC52V9PGwalrhWdI/zkgXWlFL6NH qABlx9dpDRFx1c5miwgubiOZ9Af1Eb6mEA/NS2RlPEKKX0Y4sEGpTShVyGp2UcnnkBak t/0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=TmQH9EEn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a170902820200b00153b2d16615si7043974pln.541.2022.04.03.09.46.42; Sun, 03 Apr 2022 09:47:05 -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=@google.com header.s=20210112 header.b=TmQH9EEn; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237695AbiCaQG6 (ORCPT + 99 others); Thu, 31 Mar 2022 12:06:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234903AbiCaQG5 (ORCPT ); Thu, 31 Mar 2022 12:06:57 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F6B53E02 for ; Thu, 31 Mar 2022 09:05:08 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id x2so20767plm.7 for ; Thu, 31 Mar 2022 09:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MO0/ty9ybQF1qACMJmOXTuFnMpYGfOx5VnnNgcY+e9Q=; b=TmQH9EEn6+KSh1gBo8PqXnFrR7M3fjlk1YhRq6HsA1u9WvYK1E/h1V6YCew7342jmj CgVyhbV83B0o4tUCUHKpJmY8bXMXyjAgKLsJdLXS/yopQCK7g+p5sEeXSJMGSa4LGEQd 8Xv2GF8ym+8pf5c0sqO+3XMuAGtenvpNLSsqJzzI4CsvTU5X8wDRkeYnHbJUyQohIBbR IC3lnA3ilTdmPzUTunNgMAr87OdYYR1+QC5yJqjoFt5hbCAAzizA59rokh5AmQ9R7kxi 4le4sh0HP8lOv7uRLJxF4QfvEG/moBzF3VTPq0rbbwCtsvWe+EfeFnfpS+FdfKu2Wdty uQvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MO0/ty9ybQF1qACMJmOXTuFnMpYGfOx5VnnNgcY+e9Q=; b=WHPdwFGlvVAb5bSykX4f359GU8kycYAipjPyuXODnyarWBjmiWHkzVj9tNnv5QagU+ GImgmiwdFLl3/cxx5LFXsi6olC+Qy4doP8G7vJJ4Ek7zG1yh/s3EFH2jDzwK+ZXCGSf7 U1jmaxlzsEvwPh9wkmB+WEBleSYjtqRlDVF5j2ynxYGtHPJcOFiZzA2H9YsFVoN70Fpu sWHChzDljsIV2shmFNewXhUEjLh6ksYToz71/r2d9e4bHe+CyNPe4N8KkQ2NzwTVXG0i Qa/OyOBpNlkmPGA1BfpnT3SjIN5vmIh8/1WYWNLf/yr3LCcGbG9nRj9aFwTyTwOuvMYG wNqg== X-Gm-Message-State: AOAM530mVdsr0tpxsvkVJMbFMNzTbzUf/6c2qDfGsiU8d2ltXT54dC1c oicBJ7sdnqa80947OZ2QF7EBMQ== X-Received: by 2002:a17:902:f787:b0:152:157:eb7 with SMTP id q7-20020a170902f78700b0015201570eb7mr5798057pln.109.1648742707715; Thu, 31 Mar 2022 09:05:07 -0700 (PDT) Received: from google.com ([2620:15c:202:201:a082:a097:a7d8:d309]) by smtp.gmail.com with ESMTPSA id m18-20020a639412000000b003820bd9f2f2sm23368141pge.53.2022.03.31.09.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 09:05:06 -0700 (PDT) Date: Thu, 31 Mar 2022 09:04:59 -0700 From: Benson Leung To: Greg KH 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: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gxrVt/ITKp3EpEr0" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 --gxrVt/ITKp3EpEr0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Greg, On Thu, Mar 31, 2022 at 01:38:02PM +0200, Greg KH wrote: > > > > return 0; > > > > =20 > > > > 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 devic= e *dev, int subcomponent, > > > > { > > > > struct device *base =3D data; > > > > =20 > > > > - if (strcmp(dev->driver->name, "i915") || > > > > + if (!base || !dev->driver || strcmp(dev->driver->name, "i915") || > > >=20 > > > Same here, shouldn't this be caught by the driver core or bus and mat= ch > > > should not be called? > > >=20 > > > Why not fix this in the component/driver core instead? > >=20 > > 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. > >=20 > > In our case the "components" are USB ports, so devices that are never > > bind to drivers. >=20 > 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. >=20 > 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. >=20 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. The component framework currently being used by (hdac_i915, mei_hdcp, mei_p= xp) to connect those three devices together, and completely separately, the component framework is being used by the typec connector class's port mappe= r. These two clusters of devices are using the same component framework, but a= re 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 discov= ered 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. Thanks, Benson > thanks, >=20 > greg k-h --=20 Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. bleung@google.com Chromium OS Project bleung@chromium.org --gxrVt/ITKp3EpEr0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCYkXRKwAKCRBzbaomhzOw wp7KAQD1kYuyRtUS/SBx+UJYpHjwkC8OCBsHLMHIg76Lrn/3FgD/eok7/ReIldES tWDUXAOXk48rymifKK6Ivj79qlDU0As= =cMT0 -----END PGP SIGNATURE----- --gxrVt/ITKp3EpEr0--