From 06c7ef7f6a8898588e81d71ce39f2860fac174a4 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Thu, 18 Jul 2019 07:31:42 -0400 Subject: [PATCH] lib/ftl: check for io not being NULL before dereferencing ftl_io_free() handles NULL io being passed, but shouldn't dereference it before returning. Change-Id: Ia705d4ab9f8b3569e9704a1f97e70f7579084efb Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462487 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Darek Stojaczyk Reviewed-by: Wojciech Malikowski Reviewed-by: Ben Walker --- lib/ftl/ftl_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ftl/ftl_io.c b/lib/ftl/ftl_io.c index 119f3dfcb..398e195c0 100644 --- a/lib/ftl/ftl_io.c +++ b/lib/ftl/ftl_io.c @@ -570,12 +570,13 @@ ftl_io_reset(struct ftl_io *io) void ftl_io_free(struct ftl_io *io) { - struct ftl_io *parent = io->parent; + struct ftl_io *parent; if (!io) { return; } + parent = io->parent; if (parent && ftl_io_remove_child(io)) { ftl_io_complete(parent); }