Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1504641lqm; Thu, 2 May 2024 18:18:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRfuuIuld0VmRLHTahi08CCfhq/de7xc61BGV/ahc84E2sPxx1L1hmoGzgJ+Mzhe6IG5DotUbCeKwR5hQZhFIWwG/MlwsbM+OE/u/aHA== X-Google-Smtp-Source: AGHT+IHuMV+pRUT/ido0wnCxMfFZaQ4Il+LbWxzjNPahiKgnbZrG6NXoQR+icb+RQtSIvor/mHgf X-Received: by 2002:a05:6a00:21c7:b0:6f3:8990:665c with SMTP id t7-20020a056a0021c700b006f38990665cmr1098465pfj.18.1714699129498; Thu, 02 May 2024 18:18:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714699129; cv=pass; d=google.com; s=arc-20160816; b=IJpwkXCrck0kxVrsKUvrA94XPyiEqgA97XT2EUG2Cx40QXDlDIOMkVRXEQR2hB+Vjh 2HFK3yoB+cIEd77oZS2CyS0BtJI8fGTa50nBrgpi9dezvULFUXHpTYWQA1/tLUd4J3we mEfyasdcWgKMhlFnL4YLBEx9/+TqJGvwLt18enOhJE8bASRfJIjPAtUS2EM4mN63tYtw dfGAdW/jN5hp7uPR7kCIgLv+BSX/aVAaJLNNhRXywZIh6QFwSjp771mGGnAa0HGEztAn 250NgWv6LnbEVUU1k5nesiMGBXuIONk8Q9CfVVazjsjJgC6dbjuaaFyBUNegTKlPSpVs V2lA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=5R9nVMyR6L+so5M8wI/CTn1PoIm8prQ/BbfCQ0zL2BA=; fh=7PTUSW4V+GNYqNFbUcbvbJ4WCpjjW9PHFgEcm/ZBTyc=; b=A8gb3URfxNCQzRa0GwxIcwYv8Ctm2IiCykGkZI+eBwl4V0iKBBinanWTwi6JE23Qo9 FkpeVlNGcRxD4oRZ6sdCPn/dpxK5uXMKOOli7SrPCOYQA5fugG8RefnS8wswSZJ1Jt4T wBkaE39N8G30waDzbkYWfIa6HshiyV8d/6t4XDGmZn4BxkrUDIJtwC/WNNIgQSCDtOsP KkhoXOMctH1I9CbVDcZA9DlSDMqbNTbGsXoQBTchQnYztesE5v8sgaER6Ziz52eQMUjw +gQ3Qzr8bk4n1lblpdzcXKLwbm8lXm0aoTq4ZcKeTfZmVLZyc3eOye6dNMKDWCyTJfyU twag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ubbmgbmS; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d31-20020a630e1f000000b005dc425a94d9si1959926pgl.369.2024.05.02.18.18.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 18:18:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ubbmgbmS; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167136-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167136-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 203E228475E for ; Fri, 3 May 2024 01:18:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0FC7C13D; Fri, 3 May 2024 01:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ubbmgbmS" Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B71E6BE58 for ; Fri, 3 May 2024 01:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714699123; cv=none; b=r+Mn14JAqQJmfMT13euJxyacl1OGzOTX6nUT6p4Qdouou7TwBYXYPTrZ7UDAZj7ax+QCi2dMi44PpP8EN6xi8vyRCJz0eQ9/pXNCiCof4YY8iabZFkPDna0rCz5koOhDhTXLJpbXjVWIvn/RxwM/EJ3ndThxtivixaePnwL3BF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714699123; c=relaxed/simple; bh=TOIM1TrKGfF0qDywO4J76ewCZBlUJnZflAHOCDPBgNc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CZ1pKJFk6UBLhhh+9W6vbHPIrp3rMCjHUyXWI7q+9UZfDhwy4pQcBMA9xxk9HPxbRKfEBuLUqDZbDSJf6RL40gJXE2QTMUuRW0SS+P/J07PjCViF5v5i+lYJ3QbUbmp36rGyB68Rnu6sPpSvGxx1/pQMS/XdkVL3/3dO/IteYyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ubbmgbmS; arc=none smtp.client-ip=209.85.166.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-36c6056f7bdso39475ab.0 for ; Thu, 02 May 2024 18:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714699121; x=1715303921; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5R9nVMyR6L+so5M8wI/CTn1PoIm8prQ/BbfCQ0zL2BA=; b=ubbmgbmSJiMwF6L6BvFsrQWpjmw3I3agUfvZiWNzuRXh0vq+HNUZr8H3cDIo4Qg3fC Zf8qHeISgcg1mcj6UDxkqzffEg45Fu/jF25TUxuib1B85nGdFNcOJmkMn785GAPRysIb gFG/9Yh6qaZDW2zevckSbglazue2ZXmhHDnz3Rh3tyNi/EuNGO/ZKBP+Dj0oO0UvJPLb rtWPJRyMHakYvnGCz8Klxiuvf4apoH3TrxtnxMZRcGr29P3BqIAfdSvXw44ocmByCxr0 dWOFUWlILRzjRLqpyuYgyMIGd2qjz3H2KBYmtMUMCqABq6v83DFXAH/v4MauwtBqPbed Cwpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714699121; x=1715303921; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5R9nVMyR6L+so5M8wI/CTn1PoIm8prQ/BbfCQ0zL2BA=; b=INyCNzOdFOV0j9FGykidr8JXxmHTZdQl3HRig0gf99BLwdLBgBolkg9LirnqsAba9T EEwZF1Z6j7rmv7H0QP/bREP3xsDnRiEM1jB1UKn6BdoNhHkp+AC/j3tw9yn7wzO4Tmvm VM9B90Y9hNWlifzyVF7iL7ESftqo415ppmz7nYMZcGGkbZPBracF60iQO0zogtD/Moyu hVewUnwGXFuccU8SA/krVFadVojDV3ffL8FTLCH9pys9NJoPZZ3jstao3O2qWrGHxndd xPYyDoZ0MvvNUcY/pZe8+VE8DUALWlmpnpSBrfkmMIAs9MImCPanPwb9gjawYnVBkV/b FQ6g== X-Forwarded-Encrypted: i=1; AJvYcCUA1fKn/blnRGX/5VSBxZuqaEKKuWs8IAuIiOJUKxgBVkYQbf3zJAoJQL9tkQ6h691DBdIPlO4f2kpSKZb2BnBuxY3hWgPkjI8SKOUJ X-Gm-Message-State: AOJu0YxyRQ98+0GrjIoLrWJsLtnXPwTy/8WP9MIduncC5/OigwGqfY5V sdUTEIe5ZakLRAYGQaXeXCoQOCWtHSPfKfx6lqMs6ECJA37duZxdJylDKRBMlA== X-Received: by 2002:a05:6e02:1087:b0:36c:60f9:5257 with SMTP id e9e14a558f8ab-36c7b0e5fcfmr459225ab.27.1714699120624; Thu, 02 May 2024 18:18:40 -0700 (PDT) Received: from google.com (134.90.125.34.bc.googleusercontent.com. [34.125.90.134]) by smtp.gmail.com with ESMTPSA id d11-20020a656b8b000000b005f7ff496050sm1696783pgw.76.2024.05.02.18.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 18:18:39 -0700 (PDT) Date: Fri, 3 May 2024 01:18:35 +0000 From: Benson Leung To: Jameson Thies Cc: heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org, pmalani@chromium.org, abhishekpandit@chromium.org, andersson@kernel.org, dmitry.baryshkov@linaro.org, fabrice.gasnier@foss.st.com, gregkh@linuxfoundation.org, hdegoede@redhat.com, neil.armstrong@linaro.org, rajaram.regupathy@intel.com, saranya.gopal@intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/4] usb: typec: ucsi: Fix null pointer dereference in trace Message-ID: References: <20240503003920.1482447-1-jthies@google.com> <20240503003920.1482447-2-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gZIu0tBn/a3j6Up2" Content-Disposition: inline In-Reply-To: <20240503003920.1482447-2-jthies@google.com> --gZIu0tBn/a3j6Up2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jameson, On Fri, May 03, 2024 at 12:39:17AM +0000, Jameson Thies wrote: > From: Abhishek Pandit-Subedi >=20 > ucsi_register_altmode checks IS_ERR on returned pointer and treats > NULL as valid. When CONFIG_TYPEC_DP_ALTMODE is not enabled > ucsi_register_displayport returns NULL which causese a NULL pointer > dereference in trace. Rather than return NULL, call > typec_port_register_altmode to register DisplayPort alternate mode > as a non-controllable mode when CONFIG_TYPEC_DP_ALTMODE is not enabled. >=20 > Reviewed-by: Jameson Thies > Signed-off-by: Abhishek Pandit-Subedi Reviewed-by: Benson Leung > --- > Changes in V3: > - Returns typec_port_register_altmode call from > ucsi_register_displayport when CONFIG_TYPEC_DP_ALTMODE is not enabled. >=20 > Changes in V2: > - Checks for error response from ucsi_register_displayport when > registering DisplayPort alternate mode. >=20 > drivers/usb/typec/ucsi/ucsi.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h > index c4d103db9d0f8..f66224a270bc6 100644 > --- a/drivers/usb/typec/ucsi/ucsi.h > +++ b/drivers/usb/typec/ucsi/ucsi.h > @@ -496,7 +496,7 @@ ucsi_register_displayport(struct ucsi_connector *con, > bool override, int offset, > struct typec_altmode_desc *desc) > { > - return NULL; > + return typec_port_register_altmode(con->port, desc); > } > =20 > static inline void > --=20 > 2.45.0.rc1.225.g2a3ae87e7f-goog >=20 --gZIu0tBn/a3j6Up2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCZjQ7aAAKCRBzbaomhzOw wv5KAQDnt1Bax9hdRTZgvfEDnet2yNFHbxPhj8ry665P76DzsAD/aiD6UKZfXZJN Krwb201Wx4FSZLV+3MJpNqNg2CRi7QE= =TGSn -----END PGP SIGNATURE----- --gZIu0tBn/a3j6Up2--