bdev: fix potential segmentation fault bug
As the bdev_io maybe NULL, so put the assignment after assert(bdev_io != NULL). Change-Id: I58d6fcf97931b2f431ad5680b87b098e0c9a5e9b Signed-off-by: JinYu <jin.yu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449296 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
db541f8eb3
commit
2f3147c0b2
@ -1194,11 +1194,13 @@ spdk_bdev_get_io(struct spdk_bdev_channel *channel)
|
|||||||
void
|
void
|
||||||
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
|
spdk_bdev_free_io(struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
struct spdk_bdev_mgmt_channel *ch = bdev_io->internal.ch->shared_resource->mgmt_ch;
|
struct spdk_bdev_mgmt_channel *ch;
|
||||||
|
|
||||||
assert(bdev_io != NULL);
|
assert(bdev_io != NULL);
|
||||||
assert(bdev_io->internal.status != SPDK_BDEV_IO_STATUS_PENDING);
|
assert(bdev_io->internal.status != SPDK_BDEV_IO_STATUS_PENDING);
|
||||||
|
|
||||||
|
ch = bdev_io->internal.ch->shared_resource->mgmt_ch;
|
||||||
|
|
||||||
if (bdev_io->internal.buf != NULL) {
|
if (bdev_io->internal.buf != NULL) {
|
||||||
spdk_bdev_io_put_buf(bdev_io);
|
spdk_bdev_io_put_buf(bdev_io);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user