Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1451944lqm; Thu, 2 May 2024 15:48:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdS4BQXtOsAQhGSVlXZaTsfnW4yx2EvKYmAXFuKt/gscjfMnAveFxuRsweIwPI76xyINX6LX4nFAR1j5QcU8tGRvCSJWyJTSq9exAT1g== X-Google-Smtp-Source: AGHT+IHnlFGzrlDHhUmaKSBz9bB07tMGG56QmVisdG1P58lh6yVEDGE5bJj8UKGdZewgZ2uw5cLr X-Received: by 2002:a05:6a20:a122:b0:1af:6a37:3cfd with SMTP id q34-20020a056a20a12200b001af6a373cfdmr1453856pzk.24.1714690086139; Thu, 02 May 2024 15:48:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714690086; cv=pass; d=google.com; s=arc-20160816; b=L354mnCHitrhvJ68V/Xc8EwK+BNsPSa/d2Q1aqqL+nMFMlaK3pSvG4nAZgu7mLK2X0 8s0mUVnDwJcIK3IBuuXFQd4BhPhumF6iuVqxocbWYevvlpM6TzU2LSFWTQWb2quAuAjp zMwKQdqscXw9DVvo548jSdVdv5+sqR7SfBO9ZYYQ4Ngzs7DXI0+DN4f7cWy8xAcdWL9M LqwSkocMGiEASbBsmDwvE0hDUFVz0sqYAigssRUJvvNEBldGA8gr1/H0AKZRWFcYkHa3 tDcGd1HYdCN/ffBkNBINbaIkE7OwwHVENL5I71d2TjIFnfOSrCXlmTSaU7n3e7/W00pC IxKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=ExG1KgVjgCOl88UQQAFgXZUsw2+ya82EI/LQrOPIBOQ=; fh=oDesH400hXLfelcaY4miPKfytXbRLNSt645oe0Ja7to=; b=zvEdzTVcexfUFNG0TJrK+N9kk8j3wwR72jm01bTwDoyYfAnR7GLmBitjXtXE6eQUQz 1UyzPiUchcVDfA/DKiA4ZCMuNIWY9Q8qKkTzjQM4JBbQp5jWaN8fhCX4B463JybK4II5 8BQrIvOv7GONWeBw/u1rqZH+E+3d+Cge+nBVGP79C1dFZXdwdvaTsAnLAaSPgkGlEybt c/ZcjTmcd1ZwronU+2UG/7KV7tZibFGwdJbx7ibejIp6OTFfHoSlsC9CVLc849QNIY7A rpX60E1Y55JEz7dQYMi7W/tNM9yhHe0uzzQvUblF8MtWuTRyGgju4Co4qdrdTomKonTw 5l/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Nlqh8cwj; 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-167018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167018-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. [139.178.88.99]) by mx.google.com with ESMTPS id gi15-20020a17090b110f00b002a545ed0b00si1822875pjb.166.2024.05.02.15.48.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 15:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Nlqh8cwj; 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-167018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167018-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 26B1D284A2E for ; Thu, 2 May 2024 22:48:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C287B1C2AD; Thu, 2 May 2024 22:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Nlqh8cwj" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 7B8D81BC3F for ; Thu, 2 May 2024 22:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714690077; cv=none; b=mWK6GnEkIW2MY+ZGrCiUReVT/DWe9LLxN5im4RiJSqu8ZAPJk81Wa7//5xhSGmKg3V/0i8LC1GiERH4OB7k4+Neehj2VcV+vUr6S/6e9Bj0N9HB/w+er2S8BCenGneM7lCSgjFn3f3JVc0aqjKCExT3LqmUOqGAmNUOLJR9xzy0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714690077; c=relaxed/simple; bh=ExG1KgVjgCOl88UQQAFgXZUsw2+ya82EI/LQrOPIBOQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cj4ge1KO8N9UKgq4yQFaBJGlStBHMqMqN9JRAFICzIJ4wAGlBuVqwJjVnsQCTHnxbY3Hlszm9MwvRpCp2j41nfQHi9Q8sIBNgYgmespmcljQVBgMKmH+X416J84/EMJiO+gd1mfGhtIPwNV1T0aqhHlFa+9uhzi5kBeWdfq3Wb8= 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=Nlqh8cwj; arc=none smtp.client-ip=209.85.208.49 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-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-572a1b3d6baso2453a12.1 for ; Thu, 02 May 2024 15:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714690074; x=1715294874; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ExG1KgVjgCOl88UQQAFgXZUsw2+ya82EI/LQrOPIBOQ=; b=Nlqh8cwj0jvXh8T1Dr3ar7pvlruAslj8PcTJ6SZGfI++ThcAYVOPLG22hYsvkF+9bD HFcoVULzVKCbjhFOTPdXJwUEjSV7XL31kg7lRB1wMuP92J0r/rWuqNVRzymw5Z07lzbQ QdIahAc/IZS5PRH/5zoflXB8JxfxiIN4OtVLtRbfcVGx5lndTnSYeS8zRWXBmimbPpnD f2caYbgDLdSiB2UWKd+Omdzp6NvRHr+fH4QDRO1GdLVWBx3Jfw1EFocX2jsQpyZnIZ+Q CyNwjwdwWdH2rjOOtHgFp/fVxFABHX68I4a36th5coPQaGiPPdSLWJIzyKCRfREEsQph 4nvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714690074; x=1715294874; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ExG1KgVjgCOl88UQQAFgXZUsw2+ya82EI/LQrOPIBOQ=; b=o76YGqaaXtJ4uImoXu9DPqeaGuA9ceTnzrkuyVeK3K22evtFiM4zdTcJ9As3U0kp2/ MX4gix0Z8USjTx2k/g9xh2YLHQP5OP/GKHkzuaWOwtd7A0v/zJhqPHc3nC4a3p5hTFwo 5EYMbaAa7jVnFnZwOUrAwdMQ/S/Ixc65uM3TPcIIQLHneS1RaaX8G4joRJMs9U0y8qUM l3wpyLNRpKNQI1jk/HdCsfI215zUvNcd1znStZlck3BXvKNDlB7KPu/vk3UGfBmjdEKD Yfjgkx7oEYg8hTcymKzvCOpZDu8wpOQPoQdxTgP1xEQnXsFqZ6wYxp5rIhnGwwM/v9B3 pjlQ== X-Forwarded-Encrypted: i=1; AJvYcCXTRRMWyXZ+ATGxFlQwa7uzfpwdVL+beLhRh35ru41kB+IDGxooHgCPXKEz+5QRpkMVSQvmbxegUFJJFfYqzbGJ95p3ts+gvdIr+Zca X-Gm-Message-State: AOJu0YyG+7R131gpZZWBCSBBktrwtPn4O5qghyw2dxOWocpykc0D59W1 Pl0Lmwdd0ZGEwjyKIZJWkAfnIl1d79jyxPNMyNeof3c/zg5/8Vb+24GA/TSoub1k2Bnnf5zD0/w P+/w7TCu1dlajlXpdnykJabsZ+E0i+fpWtUWe X-Received: by 2002:aa7:c44e:0:b0:572:9eec:774f with SMTP id 4fb4d7f45d1cf-572ce31e083mr67905a12.0.1714690073746; Thu, 02 May 2024 15:47:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240424014821.4154159-1-jthies@google.com> <20240424014821.4154159-2-jthies@google.com> <32855f4c-f219-4396-81c3-42cbea9fe4da@moroto.mountain> In-Reply-To: <32855f4c-f219-4396-81c3-42cbea9fe4da@moroto.mountain> From: Jameson Thies Date: Thu, 2 May 2024 15:47:41 -0700 Message-ID: Subject: Re: [PATCH v2 1/4] usb: typec: ucsi: Fix null deref in trace To: Dan Carpenter Cc: heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org, pmalani@chromium.org, bleung@google.com, 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 Content-Type: text/plain; charset="UTF-8" Hi Dan, thank you for the reference. In this case I think returning NULL from ucsi_register_displayport stub and using a NULL check to prevent a NULL pointer dereference won't give us the desired behavior. When CONFIG_TYPEC_DP_ALTMODE is not enabled, the function would return NULL and the UCSI driver will never end up registering DisplayPort alternate mode. I'll update the commit message to note that this patch adds a fallback registration for DisplayPort alternate mode in addition to simply fixing the NULL pointer dereference caused by returning it in the ucsi_register_displayport stub. Separately we could add a NULL check, but I don't think it's necessary. Neither the non-stub ucsi_register_displayport or typec_port_register_altmode look like they will return NULL. Thanks, Jameson