CVE-2026-139113 PUBLISHED

rnbd-srv: fix use-after-free on two CLOSE messages

Assigner: Linux
Reserved: 30.11.2026 Published: 30.11.2026 Updated: 01.12.2026

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

rnbd-srv: fix use-after-free on two CLOSE messages

process_msg_close() looks the sess_dev up with a kref, drops it right away, and only then takes the session mutex for the teardown. A session has several connections handled by different workers, so two CLOSE messages for the same ID both finish the lookup before either one tears the sess_dev down, and the second one works on freed memory. Any host that can open a device on the server can do that.

Take the mutex first and look the ID up with xa_load() under it. The second CLOSE then finds nothing.

Metrics

CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8

AV:N - Two RNBD_MSG_CLOSE messages carrying the same device_id arrive as RTRS RDMA-WRITE-WITH-IMM on two connections of one session; rtrs_srv_rdma_done() -> process_io_req() -> rnbd_srv_rdma_ev() -> process_msg_close(). rtrs_srv_rdma_init() listens with RDMA_PS_TCP on IN6ADDR_ANY port 1234, so RoCEv2/iWARP peers reach it over routable IP. AC:L - The peer sends both CLOSEs. Each connection has its own IB_POLL_WORKQUEUE CQ, so the handlers run concurrently, and an OPEN on a third connection holds srv_sess->lock while both rnbd_get_sess_dev() lookups succeed. A lost race leaves the second lookup at -ENXIO, which is harmless, so the attacker can retry at will. PR:N - rtrs_rdma_connect() and process_info_req() check only RTRS_MAGIC, the version, cid and uuid, with no credentials. process_msg_open() then read-only opens any block device under dev_search_path (default "/"), so an unauthenticated peer gets the device_id it needs for the two CLOSEs. UI:N - The server handles the CLOSE messages in its CQ workqueue as part of normal RTRS operation. No administrator or local user does anything. S:U - The freed rnbd_srv_sess_dev and everything the second teardown touches is memory of the server's own kernel; no VM, IOMMU or sandbox boundary is crossed. C:H - The second process_msg_close() runs rnbd_srv_destroy_dev_session_sysfs() on a kfree'd kmalloc-512 rnbd_srv_sess_dev, reading kobj->sd, parent, kset and ktype from freed memory. If another object refills the slot, those pointers are under attacker influence, which can be groomed into a kernel read. I:H - On the freed object, kobject_del() writes kobj->sd/parent/state and does kobject_put(parent). kobject_put() decrements kobj->kref, and when it reaches zero kobject_cleanup() calls t->release via a ktype pointer loaded from the reclaimed slot: memory corruption plus an indirect call through freed memory. A:H - Even with no slot reuse, the second teardown triggers a refcount-underflow WARN and KASAN use-after-free reports; with the slot reused, it dereferences wild kernfs and kobject pointers and oopses the storage server. An unauthenticated peer can repeat it.

Product Status

Vendor Linux
Product Linux
Versions Default: unaffected
  • affected from 2de6c8de192b9341ffa5e84afe1ce6196d4eef41 to c47d198faf301278927ae62802626d19c32332d5 (excl.)
  • affected from 2de6c8de192b9341ffa5e84afe1ce6196d4eef41 to d8cb9e9ba95dce0c4731f3c6cf50632fd8540cad (excl.)
  • affected from 2de6c8de192b9341ffa5e84afe1ce6196d4eef41 to 0368a1ebc080e42f5c1c2708c621deae05fdb629 (excl.)
  • affected from 2de6c8de192b9341ffa5e84afe1ce6196d4eef41 to c366173339de0cfcc3cbcaccfbe726459f9f96d4 (excl.)
  • affected from 2de6c8de192b9341ffa5e84afe1ce6196d4eef41 to ccae722c4bc716df8a4cdde462071d034f92f32d (excl.)
  • affected from 2de6c8de192b9341ffa5e84afe1ce6196d4eef41 to 4912dab88baa5f7034dc9e38807804d470ae5438 (excl.)
Vendor Linux
Product Linux
Versions Default: affected
  • Version 5.8 is affected
  • unaffected from 0 to 5.8 (excl.)
  • unaffected from 6.1.193 to 6.1.* (incl.)
  • unaffected from 6.6.163 to 6.6.* (incl.)
  • unaffected from 6.12.119 to 6.12.* (incl.)
  • unaffected from 6.18.65 to 6.18.* (incl.)
  • unaffected from 7.3.6 to 7.3.* (incl.)
  • unaffected from 7.4-rc1 to * (incl.)

References