Attention is currently required from: neels.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/31016 )
Change subject: fix possible leak of ue_context on UE REGISTER error
......................................................................
Patch Set 1:
(1 comment)
File src/osmo-hnbgw/hnbgw_hnbap.c:
https://gerrit.osmocom.org/c/osmo-hnbgw/+/31016/comment/81c3eca7_efa326d7
PS1, Line 335: ue = ue_allocated = ue_context_alloc(hnb, NULL, tmsi);
what's the point in having 2 different variables here? I see no benefit and added complexity.
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/31016
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Icf4b82f9a904d56332c567f7ccfb24231ee66270
Gerrit-Change-Number: 31016
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 18 Jan 2023 18:00:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/31016 )
Change subject: fix possible leak of ue_context on UE REGISTER error
......................................................................
fix possible leak of ue_context on UE REGISTER error
Deallocate a recently allocated UE context if the UE REGISTER procedure
fails internally, in two places.
The UE REGISTER error is rather unlikely to happen in practice: it only
occurs when encoding the HNBAP response fails, which only gets checked
input and thus is unlikely to fail.
The same code paths also possibly leak asn1c allocations -- leave those
for another patch.
Related: SYS#6297
Change-Id: Icf4b82f9a904d56332c567f7ccfb24231ee66270
---
M src/osmo-hnbgw/hnbgw_hnbap.c
1 file changed, 18 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/16/31016/1
diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index 23d1f48..4aefe2b 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -284,6 +284,7 @@
uint32_t ctx_id;
uint32_t tmsi = 0;
struct ue_context *ue;
+ struct ue_context *ue_allocated = NULL;
int rc;
memset(&accept, 0, sizeof(accept));
@@ -331,14 +332,19 @@
ue = ue_context_by_tmsi(hnb->gw, tmsi);
if (!ue)
- ue = ue_context_alloc(hnb, NULL, tmsi);
+ ue = ue_allocated = ue_context_alloc(hnb, NULL, tmsi);
asn1_u24_to_bitstring(&accept.context_ID, &ctx_id, ue->context_id);
memset(&accept_out, 0, sizeof(accept_out));
rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept);
- if (rc < 0)
+ if (rc < 0) {
+ /* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely
+ * never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */
+ if (ue_allocated)
+ ue_context_free(ue_allocated);
return rc;
+ }
msg = hnbap_generate_successful_outcome(HNBAP_ProcedureCode_id_UERegister,
HNBAP_Criticality_reject,
@@ -475,6 +481,7 @@
{
HNBAP_UERegisterRequestIEs_t ies;
struct ue_context *ue;
+ struct ue_context *ue_allocated = NULL;
char imsi[16];
int rc;
@@ -516,11 +523,18 @@
ue = ue_context_by_imsi(ctx->gw, imsi);
if (!ue)
- ue = ue_context_alloc(ctx, imsi, 0);
+ ue = ue_allocated = ue_context_alloc(ctx, imsi, 0);
hnbap_free_ueregisterrequesties(&ies);
/* Send UERegisterAccept */
- return hnbgw_tx_ue_register_acc(ue);
+ rc = hnbgw_tx_ue_register_acc(ue);
+ if (rc < 0) {
+ /* If we allocated the UE context but the UE REGISTER fails, get rid of it again: there will likely
+ * never be a UE DE-REGISTER for this UE from the HNB, and the ue_context would linger forever. */
+ if (ue_allocated)
+ ue_context_free(ue_allocated);
+ }
+ return rc;
}
static int hnbgw_rx_ue_deregister(struct hnb_context *ctx, ANY_t *in)
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/31016
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Icf4b82f9a904d56332c567f7ccfb24231ee66270
Gerrit-Change-Number: 31016
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: Hoernchen, neels, pespin, fixeria, daniel.
osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30934 )
Change subject: Add osmo_io with initial poll backend
......................................................................
Patch Set 3:
(3 comments)
File src/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/30934/comment/a198e86e_38f0e34e
PS3, Line 75: OSMO_ASSERT(0);
I suggest printing an error message and exit(1) here, since this may be the result of an unexpected value in the env var
https://gerrit.osmocom.org/c/libosmocore/+/30934/comment/47b73328_8f30fc2f
PS3, Line 171: allways
always
File src/osmo_io_poll.c:
https://gerrit.osmocom.org/c/libosmocore/+/30934/comment/a2c4b60e_98b2fb3c
PS3, Line 40: what
might be just me, but I find "flags" much more descriptive than "what"
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30934
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I50d73cf550d6ce8154bf827bf47408131cf5b0a0
Gerrit-Change-Number: 30934
Gerrit-PatchSet: 3
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 18 Jan 2023 17:39:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: laforge.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/31015 )
Change subject: Split include/Makefile.am content into subdirs
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/31015
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I785891c2f89114bf8303c799094b637d3d25ac71
Gerrit-Change-Number: 31015
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 18 Jan 2023 17:36:45 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/31009 )
Change subject: fix msgb leak for RANAP RAB Ass. Req.
......................................................................
fix msgb leak for RANAP RAB Ass. Req.
Fix leaked msgb introduced by the MGW support recently added, and from
there copied to the UPF support added after that.
Fixes leaked "RANAP Tx" msgb, one per RAB Assignment that involves an
MGW or UPF proxying of user data.
Related: SYS#6297
Change-Id: Ie30e880301346ffca72f98f8c467e56d622fb03f
---
M src/osmo-hnbgw/mgw_fsm.c
M src/osmo-hnbgw/ps_rab_ass_fsm.c
2 files changed, 2 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
pespin: Looks good to me, approved
diff --git a/src/osmo-hnbgw/mgw_fsm.c b/src/osmo-hnbgw/mgw_fsm.c
index f09300e..764e9a7 100644
--- a/src/osmo-hnbgw/mgw_fsm.c
+++ b/src/osmo-hnbgw/mgw_fsm.c
@@ -256,6 +256,7 @@
LOGPFSML(fi, LOGL_DEBUG, "forwarding modified RAB-AssignmentRequest to HNB\n");
rua_tx_dt(map->hnb_ctx, map->is_ps, map->rua_ctx_id, msg->data, msg->len);
+ msgb_free(msg);
}
static void mgw_fsm_assign(struct osmo_fsm_inst *fi, uint32_t event, void *data)
diff --git a/src/osmo-hnbgw/ps_rab_ass_fsm.c b/src/osmo-hnbgw/ps_rab_ass_fsm.c
index b298e45..e676c2c 100644
--- a/src/osmo-hnbgw/ps_rab_ass_fsm.c
+++ b/src/osmo-hnbgw/ps_rab_ass_fsm.c
@@ -352,6 +352,7 @@
return;
}
rua_tx_dt(rab_ass->map->hnb_ctx, rab_ass->map->is_ps, rab_ass->map->rua_ctx_id, msg->data, msg->len);
+ msgb_free(msg);
/* The request message has been forwarded. The response will be handled by a new FSM instance.
* We are done. */
osmo_fsm_inst_term(rab_ass->fi, OSMO_FSM_TERM_REGULAR, NULL);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/31009
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ie30e880301346ffca72f98f8c467e56d622fb03f
Gerrit-Change-Number: 31009
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged