All of lore.kernel.org
 help / color / mirror / Atom feed
* CVE-2026-90125: smb: client: fix request buffer leak in smb2_new_read_req()
@ 2026-09-17 16:09 Greg Kroah-Hartman
  0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2026-09-17 16:09 UTC (permalink / raw)
  To: linux-cve-announce; +Cc: Greg Kroah-Hartman

From: Greg Kroah-Hartman <gregkh@kernel.org>

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

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

smb: client: fix request buffer leak in smb2_new_read_req()

smb2_new_read_req() allocates the request buffer with
smb2_plain_req_init() but only publishes it to the caller with
*buf = req at the very end of the function. Two error returns sit in
between:

	rc = smb2_plain_req_init(SMB2_READ, io_parms->tcon, server,
				 (void **) &req, total_len);
	if (rc)
		return rc;

	if (server == NULL)
		return -ECONNABORTED;
	[...]
		rdata->mr = smbd_register_mr(server->smbd_conn,
					     &rdata->subreq.io_iter,
					     true, need_invalidate);
		if (!rdata->mr)
			return -EAGAIN;

On either of them the buffer is neither released nor handed back, so
it is leaked. The caller cannot clean up after it: smb2_async_readv()
does 'goto out' on a non-zero return, which skips the
cifs_small_buf_release(buf) at async_readv_out, and buf has not been
assigned at that point in any case.

The write path has never had this problem. smb2_async_writev()
registers the memory region inline and jumps to its release label
instead of returning:

	wdata->mr = smbd_register_mr(...);
	if (!wdata->mr) {
		rc = -EAGAIN;
		goto async_writev_out;
	}

Commit b7972092199f ("cifs: smbd: Retry on memory registration
failure") changed both sides from -ENOBUFS to -EAGAIN in a single
patch, which puts the two shapes next to each other.

Only the -EAGAIN return is reachable in practice, because
smb2_plain_req_init() calls smb2_reconnect() first and that already
fails with -EIO when server is NULL, before anything is allocated.
Both returns are given the same treatment here rather than leaving
one of them correct only by accident.

Because -EAGAIN is a replayable error, the failure also reaches the
retry block at the end of smb2_async_readv(), which marks the
subrequest NETFS_SREQ_NEED_RETRY, so a failing registration can be
retried rather than ending the I/O, and every attempt that reaches it
leaks another buffer. smb2_should_replay() short-circuits on
tcon->retry, so on a hard mount the attempt count is not bounded by
the retrans setting.

Only the asynchronous read path is affected. The synchronous
SMB2_read() caller passes rdata == NULL and the memory registration
block is guarded on rdata.

The memory registration failure path was pointed out by the Sashiko
AI reviewer while it was reviewing an unrelated patch to
smb2_async_readv().

The Linux kernel CVE team has assigned CVE-2026-90125 to this issue.


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

	Issue introduced in 4.16 with commit bd3dcc6a22a9186ed78da51ce09e889803552189 and fixed in 6.6.157 with commit 58066940076b90c16e821fd6f9767cd979cbdb5e
	Issue introduced in 4.16 with commit bd3dcc6a22a9186ed78da51ce09e889803552189 and fixed in 6.12.110 with commit 12092ed28434bf41e08d41e3c5269eb6b337fc02
	Issue introduced in 4.16 with commit bd3dcc6a22a9186ed78da51ce09e889803552189 and fixed in 6.18.52 with commit 442c5f1358ced0d4e716778ac06f1e323a7e4f21
	Issue introduced in 4.16 with commit bd3dcc6a22a9186ed78da51ce09e889803552189 and fixed in 7.2.6 with commit 73f6bdb0380486ab37fe12cd74de20abfaf5d3ae
	Issue introduced in 4.16 with commit bd3dcc6a22a9186ed78da51ce09e889803552189 and fixed in 7.3-rc1 with commit deb6468f4164640e4dc875f008aa449cf55987a5

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-2026-90125
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/client/smb2pdu.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/58066940076b90c16e821fd6f9767cd979cbdb5e
	https://git.kernel.org/stable/c/12092ed28434bf41e08d41e3c5269eb6b337fc02
	https://git.kernel.org/stable/c/442c5f1358ced0d4e716778ac06f1e323a7e4f21
	https://git.kernel.org/stable/c/73f6bdb0380486ab37fe12cd74de20abfaf5d3ae
	https://git.kernel.org/stable/c/deb6468f4164640e4dc875f008aa449cf55987a5

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-17 16:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 16:09 CVE-2026-90125: smb: client: fix request buffer leak in smb2_new_read_req() Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.