2fb672af | 04-Jul-2023 |
Krzysztof Karas <krzysztof.karas@intel.com> |
lib/jsonrpc: Store pointers to outstanding requests.
Currently a request is only added to a list in jsonrpc connection structure (stored inside jsonrpc server data structure), when its response is r
lib/jsonrpc: Store pointers to outstanding requests.
Currently a request is only added to a list in jsonrpc connection structure (stored inside jsonrpc server data structure), when its response is ready to send. This means that until that point, we do not have its pointer available inside jsonrpc server data, so if a server is shut down, it cannot properly handle that request. Furthermore, when server's memory is freed and connection is closed before such a request is sent, `jsonrpc_server_send_response()` will still try to insert the request into connection queue, resulting in heap-use-after-free errors. To remedy that issue, this patch introduces a new list for outstanding requests and skips sending responses in case a connection is not available.
Fixes #3052
Change-Id: I5ea6510d7cae5560654dbe2c18782e38eaa9fe97 Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19001 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <jim.harris@gmail.com> Community-CI: Mellanox Build Bot Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
show more ...
|
30b534c9 | 22-Jun-2023 |
Shuhei Matsumoto <smatsumoto@nvidia.com> |
jsonrpc: Put null byte to the end of response object in req->send_buf
If we print a JSON RPC response object in the req->send_buf simply, garbage will be contained because JSON RPC object is not req
jsonrpc: Put null byte to the end of response object in req->send_buf
If we print a JSON RPC response object in the req->send_buf simply, garbage will be contained because JSON RPC object is not required to be terminated by a null byte. To exclude garbage from print, put a null byte to the end of the JSON RPC response object before sending.
The null byte was not considered for the req->send_buf. Add one byte when allocating or reallocating the req->send_buf for the null byte.
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I1fa0b61db4ffba989da672b0d69662e3813aab8e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18828 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
show more ...
|