util/dif: check metadata buffer in spdk_dix_verify()

Fix issue #2354.

Change-Id: Idcbd6f02b215699929edd333870cfdc19a22bbbe
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11425
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Changpeng Liu 2022-02-07 23:39:36 +08:00 committed by Jim Harris
parent 3bacd6653d
commit 847139f621

View File

@ -1380,6 +1380,11 @@ spdk_dix_verify(struct iovec *iovs, int iovcnt, struct iovec *md_iov,
{
struct _dif_sgl data_sgl, md_sgl;
if (md_iov->iov_base == NULL) {
SPDK_ERRLOG("Metadata buffer is NULL.\n");
return -EINVAL;
}
_dif_sgl_init(&data_sgl, iovs, iovcnt);
_dif_sgl_init(&md_sgl, md_iov, 1);