Spdk/lib/bdev
Nathan Claudel d0038b70df bdev: fix use-after-free in bdev registration
When a bdev is registered, it is examined by the bdev modules before the
bdev register even is notified.

Examination may be asychronous, e.g. when the bdev module has to perform
I/O on the new bdev.

This causes a race condition where the bdev might be destroyed while
examination is not finished. Then, once all modules have signaled that
examination is done, `bdev_register_finished` makes an invalid access to
the freed bdev pointer.

To fix this, defer the unregistration until the examine is completed by
opening a descriptor on the bdev.

Change-Id: I79a2faa96c1c893fc1cee645fbe31f689b03ea4a
Signed-off-by: Nathan Claudel <nclaudel@kalray.eu>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13630
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2022-07-22 06:40:10 +00:00
..
bdev_internal.h Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
bdev_rpc.c Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
bdev_zone.c Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
bdev.c bdev: fix use-after-free in bdev registration 2022-07-22 06:40:10 +00:00
Makefile Bdev: remove the QD poller at the time of Bdev unregister 2022-06-28 18:13:02 +00:00
part.c Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
scsi_nvme.c Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
spdk_bdev.map bdev: Add spdk_for_each_bdev/bdev_leaf for clean up and further improvements 2022-04-05 07:30:47 +00:00
vtune.c Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00