Merge pull request #107 from imjfckm/master

Fix IO queue validation
This commit is contained in:
Michal Rakowski 2019-04-08 14:51:55 +02:00 committed by GitHub
commit 6188f3689e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) static inline int ocf_core_validate_io(struct ocf_io *io)
{ {
ocf_core_t core;
if (!io->volume) if (!io->volume)
return -EINVAL; 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 /* 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 * break I/O accounting code, resulting in use-after-free type of errors
* after cache detach, core remove etc. */ * 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 -EINVAL;
return 0; return 0;