pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-cbc/+/28691 )
Change subject: sbcap_server: Fix double-free of rx msg if conn is destroyed
......................................................................
sbcap_server: Fix double-free of rx msg if conn is destroyed
In sbcap_cbc_read_cb(), if sctp_recvmsg() fails and we end up calling
osmo_stream_srv_destroy(conn), then both conn and client will end up
being freed by sbcap_cbc_closed_cb(), so we cannot use them anymore
after calling osmo_stream_srv_destroy(conn).
Furthermore, since msg was allocated with "client" ctx as parent, it
would also be freed when "client" was freed.
Let's make the logic easier and alloc it under g_cbc, which is
guaranteed to always be kept there.
Change-Id: I201f44efa24a514e0087b6dcd01115b9b2b8e9db
---
M src/sbcap_server.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/sbcap_server.c b/src/sbcap_server.c
index 56beae6..159fa89 100644
--- a/src/sbcap_server.c
+++ b/src/sbcap_server.c
@@ -59,7 +59,7 @@
struct osmo_sbcap_cbc *cbc = osmo_stream_srv_link_get_data(link);
struct osmo_fd *ofd = osmo_stream_srv_get_ofd(conn);
SBcAP_SBC_AP_PDU_t *pdu;
- struct msgb *msg = msgb_alloc_c(client, 1500, "SBcAP-rx");
+ struct msgb *msg = msgb_alloc_c(g_cbc, 1500, "SBcAP-rx");
struct sctp_sndrcvinfo sinfo;
int flags = 0;
int rc;
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/28691
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I201f44efa24a514e0087b6dcd01115b9b2b8e9db
Gerrit-Change-Number: 28691
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: pespin.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-cbc/+/28700
to look at the new patch set (#2).
Change subject: Rename CBSP,SABP,SBcAP structs and APIs
......................................................................
Rename CBSP,SABP,SBcAP structs and APIs
Rename osmo_*_cbc -> cbc_*_mgr:
Now they only hold TCP/SCTP server related conns, but will also hold
TCP/SCTP client conns in the near future.
Rename osmo_cbc_*_client -> cbc_*_link:
The term "client" is confusing, since it doesn't exist in CBSP/SBcAP,
and will later support connecting to server at TCP/SCTP level.
Let's use "link" instead, similar to what's used in osmo-bsc which
already supports both TCP client and server modes.
Change-Id: Ia9d26dc1593c8ee08dce348fe9f5f4c9398ea2a5
---
M include/osmocom/cbc/cbc_peer.h
M include/osmocom/cbc/cbsp_server.h
M include/osmocom/cbc/sbcap_server.h
M src/cbc_main.c
M src/cbc_peer.c
M src/cbc_vty.c
M src/cbsp_server.c
M src/cbsp_server_fsm.c
M src/message_handling.c
M src/sbcap_server.c
M src/sbcap_server_fsm.c
M src/smscb_peer_fsm.c
12 files changed, 236 insertions(+), 236 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-cbc refs/changes/00/28700/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/28700
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: Ia9d26dc1593c8ee08dce348fe9f5f4c9398ea2a5
Gerrit-Change-Number: 28700
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newpatchset