From 15fb0d04bd33d7848cf7f97cd4a09b76541f3641 Mon Sep 17 00:00:00 2001 From: Jan Musial Date: Mon, 8 Apr 2019 14:40:20 +0200 Subject: [PATCH] Fix IO queue validation Signed-off-by: Jan Musial --- src/ocf_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ocf_core.c b/src/ocf_core.c index 47c3ee0..4f10335 100644 --- a/src/ocf_core.c +++ b/src/ocf_core.c @@ -172,6 +172,8 @@ static inline void dec_counter_if_req_was_dirty(struct ocf_core_io *core_io, static inline int ocf_core_validate_io(struct ocf_io *io) { + ocf_core_t core; + if (!io->volume) return -EINVAL; @@ -199,7 +201,8 @@ static inline int ocf_core_validate_io(struct ocf_io *io) /* Core volume I/O must not be queued on management queue - this would * break I/O accounting code, resulting in use-after-free type of errors * after cache detach, core remove etc. */ - if (io->io_queue == io->volume->cache->mngt_queue) + core = ocf_volume_to_core(io->volume); + if (io->io_queue == ocf_core_get_cache(core)->mngt_queue) return -EINVAL; return 0;