bdev/ocssd: verify namespace population in notification cb

Each namespace should be checked if it is populated when handling chunk
notifications.  Otherwise we risk segfaulting if a namespace gets
depopulated before the notification callback is executed.

Change-Id: Ic55104a52087b1ea7090eeaede3e2221682cd331
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482410
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Konrad Sztyber 2020-01-22 14:52:49 +01:00 committed by Jim Harris
parent 56c7da0e3b
commit d5ffabca72

View File

@ -918,7 +918,8 @@ bdev_ocssd_handle_chunk_notification(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
uint32_t nsid;
for (nsid = 0; nsid < nvme_bdev_ctrlr->num_ns; ++nsid) {
if (nvme_bdev_ctrlr->namespaces[nsid] == NULL) {
if (nvme_bdev_ctrlr->namespaces[nsid] == NULL ||
!nvme_bdev_ctrlr->namespaces[nsid]->populated) {
continue;
}