Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1492566lqm; Thu, 2 May 2024 17:40:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWV7TwyUWsapFMwcC/C8iD1BGgjs4v23tT/o/1vjC5uzJXxHRyMHTiu8AaWrhT0r/PptTwoNLz2A6beWYKkhwDo+EKpYNIQtgWsyjSBMA== X-Google-Smtp-Source: AGHT+IEBJLys3cOCXfRa60ETyz1d7o/8Av5lXBN1oCTL0edxICF3mTrBBrUwHpOST54N0FWQm0s+ X-Received: by 2002:a05:6a20:2e12:b0:1a7:aa08:16de with SMTP id be18-20020a056a202e1200b001a7aa0816demr1207972pzb.40.1714696805965; Thu, 02 May 2024 17:40:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714696805; cv=pass; d=google.com; s=arc-20160816; b=xRS2CLFhXyiGfsZUFYxTosAi59VqA6Wa5oHqMTHyQ0LIjZm/AuVMqxDNxnGNE1uJGK fuDLVXq/CGelXELQY4dIg4Bp8XiC8vjjnLu6DzpNO34jlr3lxyvnsRlRzXDpgrmD/xPo BxOajqTNN3qhIqO5ydi4mfi191Q+EBKcoRFq9EQ8fSPp3JGp4Fc9FbuV1XIqFwjc67SD 44uPu5U8+aL4wgiCrrsPlAmP7FdcHoi3K2P61iZBP9SAOIbexTzga3LLaAhzttZhhLc2 A+I3wlTBGC/RGRGlzqYejtj4gh13kUgYDOGcu69aOiks+o4OnGj82sr0aFsGafow0iW8 4/Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=y7QwxP/IR8IteTIhBkWFiOVh6L2OPrMA6wzDacMquRE=; fh=wJ4dhxgHnzCs1Zvp6O1y41zeYu5FWRbVoU8FgHf/WX8=; b=ewudYC6gmz29tnIDfULlLjvcAd+yGRJnsUEezuHn1vdR3IjufF1wa2hexn/21ViHd9 lfLFPcp5ryL+bJU7YRksqcajIjWEYVlZQxwAB4/RQxR2LO+tRq56dx8H8z0H5bsMFY+S gX/J/y2EXD1/ADs5FbD4/IXjJOZQdewf8WoJU9XyMpS2XZrCzdd1gUiTpImpXlR6NbTl SwvbpOjnbHJoOnMzcdimB+1rR7zZKU4VsghP0jSFMnDMcNwzU+xWWj0oRtaxB8T9hqAf S8A4awUBX7DgODv2y1n45iYrn4mFXXAR5Dcx3p0HoXokbZhsFoTc+UcnkMDdupPu1L9T 3Abw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JKheCkuq; arc=pass (i=1 spf=pass spfdomain=flex--jthies.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167110-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167110-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 fb28-20020a056a002d9c00b006ece0e619f5si1955408pfb.36.2024.05.02.17.40.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 17:40:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167110-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=JKheCkuq; arc=pass (i=1 spf=pass spfdomain=flex--jthies.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-167110-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167110-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 98706284BDA for ; Fri, 3 May 2024 00:40:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 483B110A1A; Fri, 3 May 2024 00:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JKheCkuq" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 238D1FC11 for ; Fri, 3 May 2024 00:39:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714696784; cv=none; b=ZkMO/mbv02TGEF8rM5HsJo9liW8RFqV0ptPAyPDLM4hWL3fG9kFqyylehrgsRao7PWMFEwaZ9AfKwVWNsSSWbrOVaABH2rNrbim+8Du/HIhj+L8rVncDYtcEGzVvB9VIy0PG4ixShCoZ1IN84kRPiJb/w40z/8POa+qSwSo1Lrw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714696784; c=relaxed/simple; bh=UP93LeOYyXTB+HImKxRgh7AV1DkTaG5cFD8ox7MDsiQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=MpBr1/Cw/haTHOAaYhh9o6iNS788YKOvdLCo/wQbNQiCFRiy/Vb8+Gadk9FLx/awcnJDnj/I8bq7mbkygVm1n/xLI8LwiY38EEUeRN6+Wka6Ad1HuDmDvrFTZvy+6xAeGi9GTTvymsc31ZJPLE9LHSsO/Lrkigjo3ZjR6s8K4tA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthies.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JKheCkuq; arc=none smtp.client-ip=209.85.219.201 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=flex--jthies.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-de60321ce6cso8559465276.1 for ; Thu, 02 May 2024 17:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714696782; x=1715301582; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=y7QwxP/IR8IteTIhBkWFiOVh6L2OPrMA6wzDacMquRE=; b=JKheCkuqmzYFl1QYiE6JECplSgRWMunYiDmQtviLllTN8XRBZxBs+Won/AWf92PI3x MdILQ5EaVyYePNfSioCzUGzUA5qouPnoHVx2Wdc4Mkt6mrSRup2hOjz0Z0fAI53o010F TGbOZvv8IWcNMF43veWAzAlr+/b4HN0adWXu5VUCUjgVvBaaQp3Z31o75bpiATL5BSPO vQ4Oi5RoYRxxC2ppiVbCYx9sRp8/MaICnV8ZFx5s4TG0+/0RQ7mh3nsdza5S/e3GIwJc G1rbB9534TTN0asHBMeSjNwXgsPKI5wk38sLEGfOp0o6dxB1sqgVUTSY6qHt5b7XmWyF 7IYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714696782; x=1715301582; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y7QwxP/IR8IteTIhBkWFiOVh6L2OPrMA6wzDacMquRE=; b=mZOISfqMbEuTwbXySiwqCF+CFW/qcf/tgjFCk6lVH7Fn+iBvhHUKcUlr445zQNN/lz cFG/xmTeDUN+dtaOSkFXVPh7T/ohuLSGiLUo7V5zuCEkVq4INP1Kx/P6usvv5FNDznwX 2r1NEjCxAKF/Kluqim3jX6p0DiC6e/6z8OsB73VhBuKHDFFkNrI+pwYiQhtFusFEAJ1R 1t9EpgHE7m7iOaL3QHp9XkUTtaIWeLW+MIYHzvLEozSXGsamz+OlVKLoOhCDP5W7ptd0 RpQSbfbk+I8X+Qoamsw/oR89wwMiY01g6vlwEvYvVYan6ZtrtslzIVHetb/qAzYTMJ0p RoPA== X-Forwarded-Encrypted: i=1; AJvYcCU4fEmI3LDE+KCgOwAktFRN+I1D4CXPX6/mP3y8SYEdL8raWkn9WEvNkVtRfpAW8ocnI7/Dy6v+pwDS0rnleRcpj0bLqOb5kwHg6rQx X-Gm-Message-State: AOJu0YwheUL62fIyKZJwQ0my/lNdoFiUxQt+dH+P2sL8385zd+7/TuQN IKPi2XU9QrB27XpJg2HHFQzvXCcOifgQ66R3IlBTfvqcnyWrVg3juYWzt31n3vwnMcWGHQ9Ty01 Oag== X-Received: from jthies.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:23db]) (user=jthies job=sendgmr) by 2002:a05:6902:2b89:b0:de5:2325:72dc with SMTP id fj9-20020a0569022b8900b00de5232572dcmr426447ybb.5.1714696782126; Thu, 02 May 2024 17:39:42 -0700 (PDT) Date: Fri, 3 May 2024 00:39:17 +0000 In-Reply-To: <20240503003920.1482447-1-jthies@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240503003920.1482447-1-jthies@google.com> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog Message-ID: <20240503003920.1482447-2-jthies@google.com> Subject: [PATCH v3 1/4] usb: typec: ucsi: Fix null pointer dereference in trace From: Jameson Thies To: heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org Cc: jthies@google.com, 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" From: Abhishek Pandit-Subedi 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. Reviewed-by: Jameson Thies Signed-off-by: Abhishek Pandit-Subedi --- Changes in V3: - Returns typec_port_register_altmode call from ucsi_register_displayport when CONFIG_TYPEC_DP_ALTMODE is not enabled. Changes in V2: - Checks for error response from ucsi_register_displayport when registering DisplayPort alternate mode. drivers/usb/typec/ucsi/ucsi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } static inline void -- 2.45.0.rc1.225.g2a3ae87e7f-goog