From a1b31293e8e6a8e6ec1483ffd2f1a54ad1c3abf5 Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Mon, 28 Sep 2020 12:57:40 -0400 Subject: [PATCH] ocf: add check ctx. Check ocf_cache_get_priv return value if returns NULL, just exit. To avoid error. Signed-off-by: yidong0635 Change-Id: Id94c4faa537f19ce9b657fbfe82ba76e2a414125 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4436 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki --- module/bdev/ocf/volume.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/bdev/ocf/volume.c b/module/bdev/ocf/volume.c index de683b8528..666eac86e3 100644 --- a/module/bdev/ocf/volume.c +++ b/module/bdev/ocf/volume.c @@ -231,6 +231,9 @@ prepare_submit(struct ocf_io *io) cache = ocf_queue_get_cache(q); cctx = ocf_cache_get_priv(cache); + if (cctx == NULL) { + return -EFAULT; + } if (q == cctx->cleaner_queue || q == cctx->mngt_queue) { io_ctx->ch = base->management_channel;