Spdk/lib
Alexey Marchuk e16f4bc7ce lib/nvmf: Defer port removal while qpairs exist in poll group
The following heap-use-after-free may happen when RDMA listener
is removed:
1. At least 2 listeners exist, at least 1 qpair is created
on each listening port
2. Listener A is removed, in nvmf_stop_listen_disconnect_qpairs
we iterate all qpair (let's say A1 and B1) and we check if qpair's
source trid matches listener's trid by calling
nvmf_transport_qpair_get_listen_trid. Trid is retrieved from
qpair->listen_id which points to the listener A cmid. Assume that
qpair's A1 trid matches, A1 starts the disconnect process
3. After iterating all qpairs on step 2 we switch to the next
IO channel and then complete port removal on RDMA transport
layer where we destroy cmid of the listener A
4. Qpair A1 still has IO submitted to bdev, destruction is postponed
5. Listener B is removed, in nvmf_stop_listen_disconnect_qpairs
we iterate all qpairs (A1 and B1) and try to check A1's listen trid.
But listener A is already destroyed, so RDMA qpair->listen_id points
to freed memory chunk

To fix this issue, nvmf_stop_listen_disconnect_qpairs was modified
to ensure that no qpairs with listen_trid == removed_trid exist
before destroying the listener.

Fixes issue #2948

Signed-off-by: Alexey Marchuk <alexeymar@nvidia.com>
Change-Id: Iba263981ff02726f0c850bea90264118289e500c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17287
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-05-09 17:58:11 +08:00
..
accel accel: add method for getting per-channel opcode stats 2023-05-09 17:58:11 +08:00
bdev accel: make spdk_accel_sequence_finish() void 2023-05-09 17:58:11 +08:00
blob blob: esnap clones are not clones 2023-05-09 17:58:11 +08:00
blobfs so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
conf so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
dma so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
env_dpdk env_dpdk: optimizing spdk_call_unaffinitized 2023-05-09 17:58:11 +08:00
env_ocf lib/env_ocf: place allocator variable on hugepages 2023-05-09 17:58:11 +08:00
event app: use --lcores to map ids greater than 128 2023-05-09 17:58:11 +08:00
ftl lib/ftl: Give correct type for seq_id variables/return types 2023-05-09 17:58:11 +08:00
idxd lib/idxd: Removed SPDK_IDXD_FLAG_PERSISTENT flag 2023-03-03 11:20:03 +00:00
init init: rewrite subsystem_sort 2023-05-09 17:58:11 +08:00
ioat so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
iscsi iscsi: Return if conn->sock is NULL when updating connection params 2023-05-09 17:58:11 +08:00
json so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
jsonrpc freebsd: return negated error from getaddrinfo() 2023-03-10 16:44:37 +00:00
log so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
lvol lvol: esnap clones must end on cluster boundary 2023-05-09 17:58:11 +08:00
mlx5 so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
nbd so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
notify so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
nvme nvme_tcp: fix memory leak when resetting controllor 2023-05-09 17:58:11 +08:00
nvmf lib/nvmf: Defer port removal while qpairs exist in poll group 2023-05-09 17:58:11 +08:00
rdma so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
reduce libreduce: removing deprecation messages for pmem 2023-05-09 17:58:11 +08:00
rocksdb rocksdb: remove spdk_thread 2022-11-23 08:22:04 +00:00
rpc so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
scsi so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
sock sock: Allow flushing even if the socket is in a poll group 2023-01-24 18:18:33 +00:00
thread thread: Move get/put calls into .c file 2023-05-09 17:58:11 +08:00
trace so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
trace_parser so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
ublk lib/ublk: use page aligned data buffer 2023-03-28 10:20:50 +00:00
ut_mock so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
util util/pipe: Simplify some null checks 2023-05-09 17:58:11 +08:00
vfio_user so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
vfu_tgt so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
vhost vhost_blk: make sure to_blk_dev() return value is not NULL 2023-05-09 17:58:11 +08:00
virtio lib/virtio_vfio_user: use VIRTIO_PCI_VRING_ALIGN aligned vring address 2023-02-09 11:31:39 +00:00
vmd so_ver: increase all major versions 2023-01-24 08:37:21 +00:00
Makefile ublk: add configure and event/subsystem 2023-01-20 07:48:25 +00:00