summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (from parent 1: dc6c508)
raw | patch | inline | side by side (from parent 1: dc6c508)
author | Angela Stegmaier <angelabaker@ti.com> | |
Thu, 14 Apr 2016 21:01:48 +0000 (16:01 -0500) | ||
committer | Angela Stegmaier <angelabaker@ti.com> | |
Wed, 20 Apr 2016 18:45:44 +0000 (13:45 -0500) |
TransportRpmsg_delete was not checking for a NULL handle
before de-referencing it, resulting in an application crash
if it was called with a NULL handle. A NULL handle was
being passed to TransportRpmsg_delete in the case where
TransportRpmsg_create socket connect call failed. In this
case, TransportRpmsg_create called TransportRpmsg_delete
with a NULL handle.
This patch adds a check for a NULL handle before de-referencing
the pointer in TransportRpmsg_delete, and also takes care
to cleanup the socket in TransportRpmsg_create in the failure
case where it cannot be cleaned by TransportRpmsg_delete.
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
before de-referencing it, resulting in an application crash
if it was called with a NULL handle. A NULL handle was
being passed to TransportRpmsg_delete in the case where
TransportRpmsg_create socket connect call failed. In this
case, TransportRpmsg_create called TransportRpmsg_delete
with a NULL handle.
This patch adds a check for a NULL handle before de-referencing
the pointer in TransportRpmsg_delete, and also takes care
to cleanup the socket in TransportRpmsg_create in the failure
case where it cannot be cleaned by TransportRpmsg_delete.
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
linux/src/transport/TransportRpmsg.c | patch | blob | history |
index 960b922ba4f99f1cce6aa6a18a4fb3546c28e439..7eb33563e19314f8006d5e9164b218c52ffe2d0a 100644 (file)
fprintf(stderr,
"TransportRpmsg_create: connect failed: %d (%s) procId: %d\n",
errno, strerror(errno), params->rprocId);
+ close(sock);
+ TransportRpmsg_module->sock[clusterId] = INVALIDSOCKET;
goto done;
}
if (obj == NULL) {
status = Ipc_E_MEMORY;
+ close(sock);
+ TransportRpmsg_module->sock[clusterId] = INVALIDSOCKET;
goto done;
}
UInt16 clusterId;
int sock;
+ if (obj == NULL) {
+ goto done;
+ }
clusterId = obj->rprocId - MultiProc_getBaseIdOfCluster();
obj = NULL;
}
+done:
*pHandle = NULL;
}