Spdk/app/spdk_dd
yidong0635 a929fa0417 spdk_dd: Fix SEGV on the error path.
We can see this app using dd_exit to cleanup.
Some error cases:
spdk_bdev_get_io_channel failed for -ENOMEM,
or it results in dd_open_bdev failed and then
dd_exit.

For a bdev, dd_exit does cleanup using spdk_put_io_channel.
And spdk_put_io_channel allows `ch == NULL`.
This causes SEGV.

So here add a separate function to check ch, and put
cleanup together.

This is found by xnvme pre-test.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I9dd860da250a86f52139e69c690dd257a7ff7717
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14195
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
2022-08-29 11:40:08 +00:00
..
.gitignore spdk_dd: Initial patch for spdk_dd tool 2020-07-23 07:24:08 +00:00
Makefile app: every app should have an (un)install target 2022-06-21 07:54:12 +00:00
spdk_dd.c spdk_dd: Fix SEGV on the error path. 2022-08-29 11:40:08 +00:00