From 13597fd4f1af33b20d166ea413b47a516ad9f87f Mon Sep 17 00:00:00 2001 From: paul luse Date: Wed, 5 Oct 2022 13:15:58 -0700 Subject: [PATCH] accel_sw: add extra check on compression We were missing a check when ISAL uses the complete output buffer on compression to determine whether it was s perfect fit or if simply not enough buffer was provided. Signed-off-by: paul luse Change-Id: I73532666f50cb9fbef3c42f6bfb25fc5c7de01c6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14874 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk --- lib/accel/accel_sw.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/accel/accel_sw.c b/lib/accel/accel_sw.c index 768699e63..a3ea21284 100644 --- a/lib/accel/accel_sw.c +++ b/lib/accel/accel_sw.c @@ -203,8 +203,13 @@ _sw_accel_compress(struct sw_accel_io_channel *sw_ch, struct spdk_accel_task *ac assert(sw_ch->stream.avail_out > 0); } else { /* we have no avail_out but also no more iovecs left so this is - * the case where the output buffer was a perfect fit for the - * compressed data and we're done. */ + * the case where either the output buffer was a perfect fit + * or not enough was provided. Check the ISAL state to determine + * which. */ + if (sw_ch->stream.internal_state.state != ZSTATE_END) { + SPDK_ERRLOG("Not enough destination buffer provided.\n"); + rc = -ENOMEM; + } break; } }