From f7561e31dee966dab61767cdb3db82b87ecb0f9e Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Wed, 21 Nov 2018 03:23:05 -0500 Subject: [PATCH] iscsi: check provided data_len for negative value during param negotiation Change-Id: Icb7184a88d93a55aa53e94bf50dab645785a6d9c Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/434178 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- lib/iscsi/param.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/iscsi/param.c b/lib/iscsi/param.c index e09bf899a..b97544641 100644 --- a/lib/iscsi/param.c +++ b/lib/iscsi/param.c @@ -886,6 +886,10 @@ spdk_iscsi_negotiate_params(struct spdk_iscsi_conn *conn, int type; total = data_len; + if (data_len < 0) { + assert(false); + return -EINVAL; + } if (alloc_len < 1) { return 0; }