iscsi, initiator: solve the use after issue.

In our current code, when we call the following statement:
spdk_bdev_destruct_done(&lun->bdev, 0);

Actually lun is already freed in bdev_iscsi_lun_cleanup function
(called by iscsi_free_lun). So this patch can be used to
prevent this issue by changing the order.

Change-Id: I5ec02319b8205fafc4d8074511f5a334b9bbb3ad
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/417630
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ziye Yang 2018-07-03 15:15:57 +08:00 committed by Jim Harris
parent 2d7cfda2d4
commit 75dce8a25c

View File

@ -295,8 +295,8 @@ bdev_iscsi_destruct_cb(void *ctx)
struct bdev_iscsi_lun *lun = ctx;
spdk_poller_unregister(&lun->no_master_ch_poller);
bdev_iscsi_lun_cleanup(lun);
spdk_bdev_destruct_done(&lun->bdev, 0);
bdev_iscsi_lun_cleanup(lun);
}
static int