Commit a40cfb40 authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Tomasz Zawadzki
Browse files

env_dpdk: fixed potential dereferencing NULL ptr



Fixed issue detected by Coverity.
If 'params' are not NULL, spdk_jsonrpc_send_error_response
is called, which may free 'request' in case of error during
sending (e.g. connection was closed). Then there shall be
return from the rpc_env_dpdk_get_mem_stats() function,
but this was not the case and rest of the code was executed.
Which in turn might cause using of already freed memory.

Removed error log, which was not related to this function.

Change-Id: I5d910fb6c9f2d14b22baa21d051d4d5db20bdd9c
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19891


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
parent f5260201
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ DEPDIRS-accel_mlx5 := accel thread log mlx5 rdma util
endif

# module/env_dpdk
DEPDIRS-env_dpdk_rpc := log $(JSON_LIBS)
DEPDIRS-env_dpdk_rpc := $(JSON_LIBS)

# module/sock
DEPDIRS-sock_posix := log sock util
+1 −1
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@ rpc_env_dpdk_get_mem_stats(struct spdk_jsonrpc_request *request,
	char default_filename[] = "/tmp/spdk_mem_dump.txt";

	if (params != NULL) {
		SPDK_ERRLOG("spdk_json_decode_object failed\n");
		spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
						 "env_dpdk_get_mem_stats doesn't accept any parameters.\n");
		return;
	}

	file = fopen(default_filename, "w");