public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, stable <stable@kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>
Subject: [PATCH 6.1 86/98] usb: typec: fix potential out of bounds in ucsi_ccg_update_set_new_cam_cmd()
Date: Tue, 12 Nov 2024 11:21:41 +0100	[thread overview]
Message-ID: <20241112101847.526172788@linuxfoundation.org> (raw)
In-Reply-To: <20241112101844.263449965@linuxfoundation.org>

6.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@linaro.org>

commit 7dd08a0b4193087976db6b3ee7807de7e8316f96 upstream.

The "*cmd" variable can be controlled by the user via debugfs.  That means
"new_cam" can be as high as 255 while the size of the uc->updated[] array
is UCSI_MAX_ALTMODES (30).

The call tree is:
ucsi_cmd() // val comes from simple_attr_write_xsigned()
-> ucsi_send_command()
   -> ucsi_send_command_common()
      -> ucsi_run_command() // calls ucsi->ops->sync_control()
         -> ucsi_ccg_sync_control()

Fixes: 170a6726d0e2 ("usb: typec: ucsi: add support for separate DP altmode devices")
Cc: stable <stable@kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/325102b3-eaa8-4918-a947-22aca1146586@stanley.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/typec/ucsi/ucsi_ccg.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/typec/ucsi/ucsi_ccg.c
+++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
@@ -441,6 +441,8 @@ static void ucsi_ccg_update_set_new_cam_
 
 	port = uc->orig;
 	new_cam = UCSI_SET_NEW_CAM_GET_AM(*cmd);
+	if (new_cam >= ARRAY_SIZE(uc->updated))
+		return;
 	new_port = &uc->updated[new_cam];
 	cam = new_port->linked_idx;
 	enter_new_mode = UCSI_SET_NEW_CAM_ENTER(*cmd);



  parent reply	other threads:[~2024-11-12 10:31 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 10:20 [PATCH 6.1 00/98] 6.1.117-rc1 review Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 01/98] arm64: dts: rockchip: Fix rt5651 compatible value on rk3399-eaidk-610 Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 02/98] arm64: dts: rockchip: Fix rt5651 compatible value on rk3399-sapphire-excavator Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 03/98] arm64: dts: rockchip: Remove hdmis 2nd interrupt on rk3328 Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 04/98] arm64: dts: rockchip: Fix wakeup prop names on PineNote BT node Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 05/98] arm64: dts: rockchip: Fix bluetooth properties on Rock960 boards Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 06/98] arm64: dts: rockchip: Remove #cooling-cells from fan on Theobroma lion Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 07/98] arm64: dts: rockchip: Fix LED triggers on rk3308-roc-cc Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 08/98] arm64: dts: imx8qm: Fix VPU core alias name Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 09/98] arm64: dts: imx8qxp: Add VPU subsystem file Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 10/98] arm64: dts: imx8-ss-vpu: Fix imx8qm VPU IRQs Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 11/98] arm64: dts: imx8mp: correct sdhc ipg clk Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 12/98] ARM: dts: rockchip: fix rk3036 acodec node Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 13/98] ARM: dts: rockchip: drop grf reference from rk3036 hdmi Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 14/98] ARM: dts: rockchip: Fix the spi controller on rk3036 Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 15/98] ARM: dts: rockchip: Fix the realtek audio codec on rk3036-kylin Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 16/98] HID: core: zero-initialize the report buffer Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 17/98] platform/x86/amd/pmc: Detect when STB is not available Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 18/98] sunrpc: handle -ENOTCONN in xs_tcp_setup_socket() Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 19/98] NFSv3: only use NFS timeout for MOUNT when protocols are compatible Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 20/98] NFSv3: handle out-of-order write replies Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 21/98] nfs: avoid i_lock contention in nfs_clear_invalid_mapping Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 22/98] security/keys: fix slab-out-of-bounds in key_task_permission Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 23/98] net: enetc: set MAC address to the VF net_device Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 24/98] sctp: properly validate chunk size in sctp_sf_ootb() Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 25/98] can: c_can: fix {rx,tx}_errors statistics Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 26/98] ice: change q_index variable type to s16 to store -1 value Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 27/98] i40e: fix race condition by adding filters intermediate sync state Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 28/98] net: hns3: fix kernel crash when uninstalling driver Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 29/98] net: phy: ti: add PHY_RST_AFTER_CLK_EN flag Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 30/98] net: stmmac: Fix unbalanced IRQ wake disable warning on single irq case Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 31/98] virtio_net: Add hash_key_length check Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 32/98] net: arc: fix the device for dma_map_single/dma_unmap_single Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 33/98] net: arc: rockchip: fix emac mdio node support Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 34/98] Revert "ALSA: hda/conexant: Mute speakers at suspend / shutdown" Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 35/98] media: stb0899_algo: initialize cfr before using it Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 36/98] media: dvbdev: prevent the risk of out of memory access Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 37/98] media: dvb_frontend: dont play tricks with underflow values Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 38/98] media: adv7604: prevent underflow condition when reporting colorspace Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 39/98] scsi: sd_zbc: Use kvzalloc() to allocate REPORT ZONES buffer Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 40/98] ALSA: firewire-lib: fix return value on fail in amdtp_tscm_init() Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 41/98] tools/lib/thermal: Fix sampling handler context ptr Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 42/98] thermal/of: support thermal zones w/o trips subnode Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 43/98] ASoC: stm32: spdifrx: fix dma channel release in stm32_spdifrx_remove Greg Kroah-Hartman
2024-11-12 10:20 ` [PATCH 6.1 44/98] media: ar0521: dont overflow when checking PLL values Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 45/98] media: s5p-jpeg: prevent buffer overflows Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 46/98] media: cx24116: prevent overflows on SNR calculus Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 47/98] media: pulse8-cec: fix data timestamp at pulse8_setup() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 48/98] media: v4l2-tpg: prevent the risk of a division by zero Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 49/98] media: v4l2-ctrls-api: fix error handling for v4l2_g_ctrl() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 50/98] can: mcp251xfd: mcp251xfd_get_tef_len(): fix length calculation Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 51/98] can: mcp251xfd: mcp251xfd_ring_alloc(): fix coalescing configuration when switching CAN modes Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 52/98] ksmbd: fix slab-use-after-free in ksmbd_smb2_session_create Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 53/98] ksmbd: Fix the missing xa_store error check Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 54/98] ksmbd: fix slab-use-after-free in smb3_preauth_hash_rsp Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 55/98] pwm: imx-tpm: Use correct MODULO value for EPWM mode Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 56/98] drm/amdgpu: Adjust debugfs eviction and IB access permissions Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 57/98] drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 58/98] drm/amdgpu: prevent NULL pointer dereference if ATIF is not supported Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 59/98] thermal/drivers/qcom/lmh: Remove false lockdep backtrace Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 60/98] dm cache: correct the number of origin blocks to match the target length Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 61/98] dm cache: fix flushing uninitialized delayed_work on cache_ctr error Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 62/98] dm cache: fix out-of-bounds access to the dirty bitset when resizing Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 63/98] dm cache: optimize dirty bit checking with find_next_bit " Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 64/98] dm cache: fix potential out-of-bounds access on the first resume Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 65/98] dm-unstriped: cast an operand to sector_t to prevent potential uint32_t overflow Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 66/98] ALSA: usb-audio: Add quirk for HP 320 FHD Webcam Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 67/98] ALSA: hda/realtek: Fix headset mic on TUXEDO Gemini 17 Gen3 Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 68/98] posix-cpu-timers: Clear TICK_DEP_BIT_POSIX_TIMER on clone Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 69/98] nfs: Fix KMSAN warning in decode_getfattr_attrs() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 70/98] net: wwan: t7xx: Fix off-by-one error in t7xx_dpmaif_rx_buf_alloc() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 71/98] net: vertexcom: mse102x: Fix possible double free of TX skb Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 72/98] mptcp: use sock_kfree_s instead of kfree Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 73/98] arm64: Kconfig: Make SME depend on BROKEN for now Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 74/98] btrfs: reinitialize delayed ref list after deleting it from the list Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 75/98] riscv/purgatory: align riscv_kernel_entry Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 76/98] bnxt_re: avoid shift undefined behavior in bnxt_qplib_alloc_init_hwq Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 77/98] Revert "wifi: mac80211: fix RCU list iterations" Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 78/98] net: do not delay dst_entries_add() in dst_release() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 79/98] kselftest/arm64: Initialise current at build time in signal tests Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 80/98] media: uvcvideo: Skip parsing frames of type UVC_VS_UNDEFINED in uvc_parse_format Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 81/98] filemap: Fix bounds checking in filemap_read() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 82/98] fs/proc: fix compile warning about variable vmcore_mmap_ops Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 83/98] signal: restore the override_rlimit logic Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 84/98] usb: musb: sunxi: Fix accessing an released usb phy Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 85/98] usb: dwc3: fix fault at system suspend if device was already runtime suspended Greg Kroah-Hartman
2024-11-12 10:21 ` Greg Kroah-Hartman [this message]
2024-11-12 10:21 ` [PATCH 6.1 87/98] USB: serial: io_edgeport: fix use after free in debug printk Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 88/98] USB: serial: qcserial: add support for Sierra Wireless EM86xx Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 89/98] USB: serial: option: add Fibocom FG132 0x0112 composition Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 90/98] USB: serial: option: add Quectel RG650V Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 91/98] irqchip/gic-v3: Force propagation of the active state with a read-back Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 92/98] ocfs2: remove entry once instead of null-ptr-dereference in ocfs2_xa_remove() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 93/98] ucounts: fix counter leak in inc_rlimit_get_ucounts() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 94/98] ASoC: amd: yc: fix internal mic on Xiaomi Book Pro 14 2022 Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 95/98] net: sched: use RCU read-side critical section in taprio_dump() Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 96/98] hv_sock: Initializing vsk->trans to NULL to prevent a dangling pointer Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 97/98] vsock/virtio: Initialization of the dangling pointer occurring in vsk->trans Greg Kroah-Hartman
2024-11-12 10:21 ` [PATCH 6.1 98/98] media: amphion: Fix VPU core alias name Greg Kroah-Hartman
2024-11-12 20:56 ` [PATCH 6.1 00/98] 6.1.117-rc1 review Pavel Machek
2024-11-12 23:17 ` Shuah Khan
2024-11-13  0:22 ` Florian Fainelli
2024-11-13  0:38 ` Ron Economos
2024-11-13 11:23 ` Naresh Kamboju
2024-11-13 13:29 ` Mark Brown
2024-11-13 18:35 ` Peter Schneider
2024-11-13 19:58 ` Jon Hunter
2024-11-14 10:50 ` [PATCH 6.1] " Hardik Garg
2024-11-28 18:05 ` [PATCH 6.1 00/98] " Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241112101847.526172788@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox