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 6725E18B48A; Tue, 10 Sep 2024 10:41:23 +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=1725964883; cv=none; b=dfH8Bb91/7Zv+o5FtH12oj8s5BoyAOPlTEu22srNa+ptjy45h2kFw9bPqMhFRIIk0rsXWybaZxTAu8qHCMy0sBm215OyzYTpRv4BA2DsDrMBQw69Ge2vUAPPpDG92hgIxcugQbwz6cQ9PUQf9R0ZlVuMhAdKaf8W15bONi1RRDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725964883; c=relaxed/simple; bh=48paRn2eiLpphv5/147aHYxUaQZPWSsMjnChy+urEjo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MWqHdgymVzYGLkrjlNIxmCpoICOix/c+2jTHPENv/XPOWr+l2xCsqB7HiM7vjUkVw1WCT0qjV+ZWa/byP2+TjwVp3xTnFlT8nTsLg75e6iGqTdk1iLLQOOodyfpahRZGLbt85BLz6uNYqSM0rKczbPvvhtUX51tw3Mf9VT1epqQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZVrQvh4J; 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="ZVrQvh4J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC0E5C4CEC3; Tue, 10 Sep 2024 10:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725964883; bh=48paRn2eiLpphv5/147aHYxUaQZPWSsMjnChy+urEjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVrQvh4JiGxRQk7QALkSc8LbffWgbvRXotpnzE+iwubAK3oFl0pPO4dog8bOnTDn/ 3Z+Y9ykm/awXzyOMiITJLRslxXW3dSaECFKkCiBv4gQGBX/3fJjuYWv4hK1Pin6nZ0 rGq1LBRAyKNVPGrK8IAoIQuEX0g5rUFPO2GwoHxg= 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 5.10 036/186] usb: typec: ucsi: Fix null pointer dereference in trace Date: Tue, 10 Sep 2024 11:32:11 +0200 Message-ID: <20240910092556.040452110@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092554.645718780@linuxfoundation.org> References: <20240910092554.645718780@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.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 41e1a64da82e..f75b1e2c05fe 100644 --- a/drivers/usb/typec/ucsi/ucsi.h +++ b/drivers/usb/typec/ucsi/ucsi.h @@ -365,7 +365,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