In the Linux kernel, the following vulnerability has been resolved:
RDMA/srpt: Fix srpt_alloc_rw_ctxs() unwind counters
When srpt_alloc_rw_ctxs() fails partway through a multi-buffer indirect
descriptor, the unwind path destroys RDMA contexts but leaves stale
n_rw_ctx and n_rdma values (and a dangling rw_ctxs pointer). Later
sq_wr_avail accounting in srpt_queue_response() or srpt_write_pending()
can then subtract the wrong number of send queue credits.
Reset the counters and clear rw_ctxs after freeing the heap
allocation before returning an error.
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 - The descriptor table that makes srpt_alloc_rw_ctxs() fail partway (idb->desc_list entries, table_desc.len, data_out/in_desc_cnt) comes in a remote initiator's SRP_CMD IU. The path is srpt_recv_done->srpt_handle_new_iu->srpt_handle_cmd->srpt_get_desc_tbl, and srpt also accepts logins through its RDMA-CM listener, which runs over routable RoCEv2 (UDP/IP).
AC:L - The initiator picks the failure point: a small first descriptor followed by one with db->len=0xFFFFFFFF, whose scatterlist array is too big for sgl_alloc_order() to allocate. target_alloc_sgl() then fails at i>=1 every time, leaving n_rw_ctx>=1 and a dangling rw_ctxs. No race or outside state is needed.
PR:N - SRP login (srpt_cm_req_recv) has no authentication. It only compares the initiator port ID that the initiator itself claims against the configured ACL, and the malformed SRP_CMD is parsed right after login.
UI:N - The initiator sends the malformed SRP_CMD over its own channel, and no action by the target's administrator or any user is needed.
S:U - The use-after-free and crash happen in the target host's kernel, which is the same security authority that runs ib_srpt. No VM or IOMMU boundary is crossed.
C:H - In kernels from v4.7 up to v5.1, srpt_handle_cmd's release_ioctx path calls srpt_release_cmd(). Because n_rw_ctx is stale, srpt_free_rw_ctxs() reads the kfree'd rw_ctxs array, a use-after-free on a slab object the attacker can reclaim.
I:H - The same srpt_free_rw_ctxs() pass calls rdma_rw_ctx_destroy() and target_free_sgl() again on ctx->sg lists the unwind loop already freed. That is a double free of the scatterlists and their data pages, a memory-corruption primitive.
A:H - Each malformed SRP_CMD can be repeated at will and corrupts the heap (UAF plus double free) on older kernels. On newer kernels the busy path reached after this failure crashes the target, so any initiator can repeatedly take down the SRP target host.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:N - The descriptor table that makes srpt_alloc_rw_ctxs() fail partway (idb->desc_list entries, table_desc.len, data_out/in_desc_cnt) comes in a remote initiator's SRP_CMD IU. The path is srpt_recv_done->srpt_handle_new_iu->srpt_handle_cmd->srpt_get_desc_tbl, and srpt also accepts logins through its RDMA-CM listener, which runs over routable RoCEv2 (UDP/IP).
AC:L - The initiator picks the failure point: a small first descriptor followed by one with db->len=0xFFFFFFFF, whose scatterlist array is too big for sgl_alloc_order() to allocate. target_alloc_sgl() then fails at i>=1 every time, leaving n_rw_ctx>=1 and a dangling rw_ctxs. No race or outside state is needed.
PR:N - SRP login (srpt_cm_req_recv) has no authentication. It only compares the initiator port ID that the initiator itself claims against the configured ACL, and the malformed SRP_CMD is parsed right after login.
UI:N - The initiator sends the malformed SRP_CMD over its own channel, and no action by the target's administrator or any user is needed.
S:U - The use-after-free and crash happen in the target host's kernel, which is the same security authority that runs ib_srpt. No VM or IOMMU boundary is crossed.
C:H - In kernels from v4.7 up to v5.1, srpt_handle_cmd's release_ioctx path calls srpt_release_cmd(). Because n_rw_ctx is stale, srpt_free_rw_ctxs() reads the kfree'd rw_ctxs array, a use-after-free on a slab object the attacker can reclaim.
I:H - The same srpt_free_rw_ctxs() pass calls rdma_rw_ctx_destroy() and target_free_sgl() again on ctx->sg lists the unwind loop already freed. That is a double free of the scatterlists and their data pages, a memory-corruption primitive.
A:H - Each malformed SRP_CMD can be repeated at will and corrupts the heap (UAF plus double free) on older kernels. On newer kernels the busy path reached after this failure crashes the target, so any initiator can repeatedly take down the SRP target host.
CVSS 3.1