---
id: "CVE-2026-98870"
kind: "vulnerability"
aliases: ["CVE-2026-98870"]
title: "Linux kernel ksmbd: stale SMB channels cause use-after-free on teardown"
severity: "unknown"
cvss: null
epss: 0.0025
exploited: false
status: "open"
category: "infrastructure"
products: []
ecosystems: []
tags: ["infrastructure", "ksmbd", "linux-kernel", "self-hosted", "smb-server"]
not_affected_if: ["ksmbd-not-loaded", "no-smb-file-sharing", "samba-userspace"]
published_at: "2026-10-23T12:18:20+00:00"
first_seen_at: "2026-10-23T21:57:33+00:00"
updated_at: "2026-10-25T12:38:51+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-98870", "first_seen_at": "2026-10-23T21:57:33+00:00"}, {"source": "epss", "url": "https://api.first.org/data/v1/epss?cve=CVE-2026-98870", "first_seen_at": "2026-10-25T12:38:51+00:00"}]
---

# Linux kernel ksmbd: stale SMB channels cause use-after-free on teardown

The ksmbd in-kernel SMB server leaves a disconnected connection's channel on another session's channel list, so teardown writes into freed memory. The sources describe a use-after-free write and a leaked session, which can lead to memory corruption or a crash on a host running ksmbd.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check whether ksmbd is loaded or enabled on the host, for example with `lsmod | grep ksmbd` or `systemctl status ksmbd`
- Compare the running kernel with the fixed release listed in the kernel stable advisory: `uname -r`

## Fix

- Update to a Linux kernel release that includes the upstream commit removing the conn->binding gate in ksmbd_sessions_deregister(); the exact fixed version is unknown from the sources
- Until patched, unload the module with `rmmod ksmbd` if SMB serving is not needed

## Timeline

- 2026-10-23T21:57:33+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-98870
- 2026-10-25T12:38:51+00:00 epss https://api.first.org/data/v1/epss?cve=CVE-2026-98870

## From the sources

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

ksmbd: remove stale channels from all sessions on teardown

ksmbd_sessions_deregister() removes a connection's channels from other
sessions' channel lists only while conn->binding is still set:

	if (conn->binding) {
		hash_for_each_safe(sessions_table, ...)
			ksmbd_chann_del(conn, sess);
	}

conn->binding is a transient flag: it is cleared once a binding
SESSION_SETUP completes, and also by a subsequent non-binding
SESSION_SETUP on the same connection (a reauthentication on a bound
channel, or a new SessionId==0 setup). A connection that has bound a
channel into another session's ksmbd_chann_list and then clears
conn->binding leaves that channel behind when it disconnects: the
channel, whose chann->conn points at the now freed struct ksmbd_conn,
stays on the owner session's list.

When the owning connection later tears down, the second loop
dereferences the stale channel:

	xa_for_each(&sess->ksmbd_chann_list, chann_id, chann)
		if (chann->conn != conn)
			ksmbd_conn_set_exiting(chann->conn);   /* freed */

which is a use-after-free write into the freed ksmbd_conn (the same
stale channel is also walked by show_proc_session() through /proc). The
session is leaked as well, because its channel list never empties.

Remove the conn->binding gate so a connection always removes its
channels from every session on teardown.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
