Skip to contentSkip to conversation

CVE-2025-37947: ksmbd: prevent out-of-bounds stream writes by validating *pos

DISCUSSION Greg Kroah-Hartman 1 participant 1 message May 20, 2025

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

ksmbd: prevent out-of-bounds stream writes by validating *pos

ksmbd_vfs_stream_write() did not validate whether the write offset (*pos) was within the bounds of the existing stream data length (v_len). If *pos was greater than or equal to v_len, this could lead to an out-of-bounds memory write.

This patch adds a check to ensure *pos is less than v_len before proceeding. If the condition fails, -EINVAL is returned.

The Linux kernel CVE team has assigned CVE-2025-37947 to this issue.

Affected and fixed versions
===========================

	Fixed in 6.1.139 with commit 7f61da79df86fd140c7768e668ad846bfa7ec8e1
	Fixed in 6.6.91 with commit 04c8a38c60346bb5a7c49b276de7233f703ce9cb
	Fixed in 6.12.29 with commit d62ba16563a86aae052f96d270b3b6f78fca154c
	Fixed in 6.14.7 with commit e6356499fd216ed6343ae0363f4c9303f02c5034
	Fixed in 6.15-rc6 with commit 0ca6df4f40cf4c32487944aaf48319cb6c25accc

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2025-37947

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
fs/smb/server/vfs.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/7f61da79df86fd140c7768e668ad846bfa7ec8e1
	https://git.kernel.org/stable/c/04c8a38c60346bb5a7c49b276de7233f703ce9cb
	https://git.kernel.org/stable/c/d62ba16563a86aae052f96d270b3b6f78fca154c
	https://git.kernel.org/stable/c/e6356499fd216ed6343ae0363f4c9303f02c5034
	https://git.kernel.org/stable/c/0ca6df4f40cf4c32487944aaf48319cb6c25accc