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 F35822EF650 for ; Tue, 17 Jun 2025 14:26:12 +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=1750170373; cv=none; b=jk5nfHrIw1WNHYKQvq230/RX9iLQEaEoeInGdlox85BsHHDRW8KC/IE5s+aABbZfYN22LrLORulyCoHZDcm6xpzhPeW+RdHEo0NJPm6FWsJmpgNwF2H1soQjD2RKVlPqMffJhtnUGHV6r2eE/d5H2wR1Z0LRPB4rtkm8/geSDIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750170373; c=relaxed/simple; bh=yQOFY+4fWvH+FWKpGShbrtf6ZgwwG0UA3ir5jQG7W0Y=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=saFpNB696er5trJGpbHSTFTNQor9TVI+kElhLuNRnUHbel0k+z26GZG/Ji8VM758TVxq+5xcjLZVKX2F0JvsuNjx5/ImvJMC7hHO5XCB6g8EDKiig+DvlGCpZrd5WHhZyfKRuHgY5wwnd4EK4VBPIu2xbXf8bug8oOek5Zg7mUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ArdKvww1; 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="ArdKvww1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 090EAC4CEE3; Tue, 17 Jun 2025 14:26:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750170372; bh=yQOFY+4fWvH+FWKpGShbrtf6ZgwwG0UA3ir5jQG7W0Y=; h=Subject:To:Cc:From:Date:From; b=ArdKvww1T8Y9BPODV7WLLLDsgJqzbawub+HGf4DLUpiDKXy50mCWbvznI7zWPd81E bS/UtvPoJGFLsxDXy8Bh8Hii8frwj7H+5frMfNN7cknjNiYSxaAE9wSP5xSF87gl8t Izx/mKu1ntenZ87hfN9gQ9FZT1KkotSO8bqvuknI= Subject: FAILED: patch "[PATCH] usb: typec: tcpm/tcpci_maxim: Fix bounds check in" failed to apply to 5.10-stable tree To: amitsd@google.com,badhri@google.com,gregkh@linuxfoundation.org,heikki.krogerus@linux.intel.com,kyletso@google.com,stable@kernel.org Cc: From: Date: Tue, 17 Jun 2025 16:26:09 +0200 Message-ID: <2025061709-nacho-bronchial-18a8@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 0736299d090f5c6a1032678705c4bc0a9511a3db # git commit -s git send-email --to '' --in-reply-to '2025061709-nacho-bronchial-18a8@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 0736299d090f5c6a1032678705c4bc0a9511a3db Mon Sep 17 00:00:00 2001 From: Amit Sunil Dhamne Date: Fri, 2 May 2025 16:57:03 -0700 Subject: [PATCH] usb: typec: tcpm/tcpci_maxim: Fix bounds check in process_rx() Register read of TCPC_RX_BYTE_CNT returns the total size consisting of: PD message (pending read) size + 1 Byte for Frame Type (SOP*) This is validated against the max PD message (`struct pd_message`) size without accounting for the extra byte for the frame type. Note that the struct pd_message does not contain a field for the frame_type. This results in false negatives when the "PD message (pending read)" is equal to the max PD message size. Fixes: 6f413b559f86 ("usb: typec: tcpci_maxim: Chip level TCPC driver") Signed-off-by: Amit Sunil Dhamne Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Kyle Tso Cc: stable Link: https://lore.kernel.org/stable/20250502-b4-new-fix-pd-rx-count-v1-1-e5711ed09b3d%40google.com Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20250502-b4-new-fix-pd-rx-count-v1-1-e5711ed09b3d@google.com Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c index 29a4aa89d1a1..b5a5ed40faea 100644 --- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c +++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c @@ -166,7 +166,8 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status) return; } - if (count > sizeof(struct pd_message) || count + 1 > TCPC_RECEIVE_BUFFER_LEN) { + if (count > sizeof(struct pd_message) + 1 || + count + 1 > TCPC_RECEIVE_BUFFER_LEN) { dev_err(chip->dev, "Invalid TCPC_RX_BYTE_CNT %d\n", count); return; }