neels has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-upf refs/changes/71/31271/1

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;

--
To view, visit https://gerrit.osmocom.org/c/osmo-upf/+/31271
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-upf
Gerrit-Branch: master
Gerrit-Change-Id: Ibb666d62b8469dbf0b13cdf25e6912c02fbc4fa9
Gerrit-Change-Number: 31271
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to