Commit ec5972cb authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

bdev: fix io_channel leaks on bdev channel creation failure



The underlying io_channel created by a bdev module
could be never freed in various cases due to missing
spdk_put_io_channel() calls.

Change-Id: If1aa736f67f0354c4f9dcdf61d3f1e6b859b4c48
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/438803


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarwuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 480b0b9e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1818,6 +1818,7 @@ spdk_bdev_channel_create(void *io_device, void *ctx_buf)

	mgmt_io_ch = spdk_get_io_channel(&g_bdev_mgr);
	if (!mgmt_io_ch) {
		spdk_put_io_channel(ch->channel);
		return -1;
	}

@@ -1833,6 +1834,7 @@ spdk_bdev_channel_create(void *io_device, void *ctx_buf)
	if (shared_resource == NULL) {
		shared_resource = calloc(1, sizeof(*shared_resource));
		if (shared_resource == NULL) {
			spdk_put_io_channel(ch->channel);
			spdk_put_io_channel(mgmt_io_ch);
			return -1;
		}