From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AA00156225; Thu, 5 Sep 2024 09:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725529758; cv=none; b=eNdqhpf1Ykr71QAMSHzkQWadg+7XM9hyI59owQS1OHzEEoQZZwHlR/Nk85tbaa3Co20AFzacasvNClclsos+uCAutS79m0rJXBi1HK8I0ievD5k11s6tyhb9nZSF7zF/E97cXyZnV8B+Y1KmLkKxrXT2Id+7s7Nlz//6ICRzDgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725529758; c=relaxed/simple; bh=KltYsM6kwx29Kp+SDC0qJzD1h2tY7OA+qz5HfONFPkI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PhMgBaoC0f43kGCKNYDFvpHJiYbboNZSHA29mOXkgd9i5zAiknHoaOgaNnWiLZJKfxuBXJ0a0wOY9YaRPmmnD7S/X5tS8JyXyx1XO+0Uh2W9/N4MB9+Zn0iI+HLFg1obqkE0NKBJy4rYt5Fk4mzdGwXwC0Et2eJ3oAIQmAix9hk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tKOvZLvE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tKOvZLvE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78864C4CEC3; Thu, 5 Sep 2024 09:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725529757; bh=KltYsM6kwx29Kp+SDC0qJzD1h2tY7OA+qz5HfONFPkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKOvZLvEEja4OKsPAueju6CA8vFlfbphUsu4lAMPoBcwjGNjG0zdUdaHNK6OD2rUx j/BiELMoYXfXki7PLwhlnyQOprSDbkRdNzA7sgwoS4XB3AqIvW0ZM63kCfmIrDgYL0 qc2YWLSfoRnVBiRLFl1lDxvWurZrLnW28Btw4MsY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Benson Leung , Heikki Krogerus , Abhishek Pandit-Subedi , Jameson Thies , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 6.10 134/184] usb: typec: ucsi: Fix null pointer dereference in trace Date: Thu, 5 Sep 2024 11:40:47 +0200 Message-ID: <20240905093737.453590832@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240905093732.239411633@linuxfoundation.org> References: <20240905093732.239411633@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abhishek Pandit-Subedi [ Upstream commit 99516f76db48e1a9d54cdfed63c1babcee4e71a5 ] ucsi_register_altmode checks IS_ERR for the alt pointer and treats NULL as valid. When CONFIG_TYPEC_DP_ALTMODE is not enabled, ucsi_register_displayport returns NULL which causes 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: Benson Leung Reviewed-by: Heikki Krogerus Signed-off-by: Abhishek Pandit-Subedi Signed-off-by: Jameson Thies Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20240510201244.2968152-2-jthies@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 c4d103db9d0f..f66224a270bc 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.43.0