neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-upf/+/31271 )
Change subject: fix various crashes on osmo_pfcp_endpoint_tx() err handling ......................................................................
fix various crashes on osmo_pfcp_endpoint_tx() err handling
osmo_pfcp_endpoint_tx() deallocates the PFCP msg on error. Make sure osmo-upf doesn't use the PFCP msg after passing it to osmo_pfcp_endpoint_tx().
Change-Id: Ibb666d62b8469dbf0b13cdf25e6912c02fbc4fa9 --- M src/osmo-pfcp-tool/pfcp_tool.c M src/osmo-upf/up_peer.c 2 files changed, 4 insertions(+), 3 deletions(-)
Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve pespin: Looks good to me, approved
diff --git a/src/osmo-pfcp-tool/pfcp_tool.c b/src/osmo-pfcp-tool/pfcp_tool.c index aebb92c..ff93cd0 100644 --- a/src/osmo-pfcp-tool/pfcp_tool.c +++ b/src/osmo-pfcp-tool/pfcp_tool.c @@ -162,11 +162,11 @@ int peer_tx(struct pfcp_tool_peer *peer, struct osmo_pfcp_msg *m) { int rc; - rc = osmo_pfcp_endpoint_tx(g_pfcp_tool->ep, m); if (m->is_response) peer->last_resp = *m; else peer->last_req = *m; + rc = osmo_pfcp_endpoint_tx(g_pfcp_tool->ep, m); return rc; }
diff --git a/src/osmo-upf/up_peer.c b/src/osmo-upf/up_peer.c index 6039b6a..ec50674 100644 --- a/src/osmo-upf/up_peer.c +++ b/src/osmo-upf/up_peer.c @@ -217,7 +217,8 @@ };
if (osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, resp)) { - OSMO_LOG_PFCP_MSG(resp, LOGL_ERROR, "Error sending response, cannot associate with peer\n"); + OSMO_LOG_PFCP_MSG(m, LOGL_ERROR, "Error sending response to this message," + " cannot associate with peer\n"); return -EIO; } return 0; @@ -234,7 +235,7 @@ };
if (osmo_pfcp_endpoint_tx(peer->up_endpoint->pfcp_ep, resp)) { - OSMO_LOG_PFCP_MSG(resp, LOGL_ERROR, "Error sending response\n"); + OSMO_LOG_PFCP_MSG(m, LOGL_ERROR, "Error sending response to this message\n"); return -EIO; } return 0;