From a2340f36fa9462d54ea39eb6495ab4800ed1e038 Mon Sep 17 00:00:00 2001 From: Gal Hammer Date: Sun, 26 Dec 2021 09:44:04 +0200 Subject: [PATCH] bdev/ocf: Fix set_data callback's data pointer check The function returns -ENOBUFS when handling OCF_WRITE_FLUSH requests on a disk with a size which its lower 32-bits are zeros. Zeroing the request buffer length occurs when creating a new ocf_io and assigning a 64-bit value to a 32-bit value in vbdev_ocf.c:io_handle. This patch fixes the condition to check if the request have a payload (data->iovs) before checking for the size limitation. Signed-off-by: Gal Hammer Signed-off-by: Shai Fultheim Change-Id: I2c6d03fee32a8fbed7beffdac6fef6a478ea4211 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10896 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Rafal Stefanowski Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- module/bdev/ocf/volume.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/bdev/ocf/volume.c b/module/bdev/ocf/volume.c index 028db40f3..a24cfa78e 100644 --- a/module/bdev/ocf/volume.c +++ b/module/bdev/ocf/volume.c @@ -88,7 +88,8 @@ vbdev_ocf_volume_io_set_data(struct ocf_io *io, ctx_data_t *data, io_ctx->offset = offset; io_ctx->data = data; - if (io_ctx->data && offset >= io_ctx->data->size) { + assert(io_ctx->data != NULL); + if (io_ctx->data->iovs && offset >= io_ctx->data->size) { return -ENOBUFS; }