neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32521 )
Change subject: fix vty: show talloc-context all
......................................................................
fix vty: show talloc-context all
Without "null tracking" enabled, the VTY 'show talloc-ctx all' shows
nothing at all.
Since the talloc_asn1_ctx is "created in NULL ctx", it was not visible
in any talloc reports before this patch.
This patch uncovers a slur of leaks, which accumulate in
talloc_asn1_ctx. Fixes follow.
Related: SYS#6297
Change-Id: I5cb4e9a3b393100877f03d68a09acf5817c5a878
---
M src/osmo-hnbgw/hnbgw.c
1 file changed, 21 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
msuraev: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index bd45dda..50ada60 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -729,6 +729,8 @@
struct osmo_stream_srv_link *srv;
int rc;
+ talloc_enable_null_tracking();
+
tall_hnb_ctx = talloc_named_const(NULL, 0, "hnb_context");
talloc_asn1_ctx = talloc_named_const(NULL, 1, "asn1_context");
msgb_talloc_ctx_init(tall_hnb_ctx, 0);
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32521
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I5cb4e9a3b393100877f03d68a09acf5817c5a878
Gerrit-Change-Number: 32521
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32525 )
Change subject: fix asn1 leak in error path of hnbgw_tx_ue_register_acc_tmsi()
......................................................................
fix asn1 leak in error path of hnbgw_tx_ue_register_acc_tmsi()
Related: SYS#6297
Change-Id: Iad1519aea36d8b6fef51fedb22a861ad1bc462fc
---
M src/osmo-hnbgw/hnbgw_hnbap.c
1 file changed, 27 insertions(+), 14 deletions(-)
Approvals:
pespin: Looks good to me, approved
msuraev: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/osmo-hnbgw/hnbgw_hnbap.c b/src/osmo-hnbgw/hnbgw_hnbap.c
index bc3dccd..980c6b0 100644
--- a/src/osmo-hnbgw/hnbgw_hnbap.c
+++ b/src/osmo-hnbgw/hnbgw_hnbap.c
@@ -338,19 +338,8 @@
memset(&accept_out, 0, sizeof(accept_out));
rc = hnbap_encode_ueregisteraccepties(&accept_out, &accept);
- 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,
- &asn_DEF_HNBAP_UERegisterAccept,
- &accept_out);
-
+ /* free 'accept', now encoded in 'accept_out' */
switch (ue_id->present) {
case HNBAP_UE_Identity_PR_tMSILAI:
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_BIT_STRING,
@@ -377,9 +366,23 @@
break;
}
- ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBAP_UERegisterAccept, &accept_out);
+ if (rc < 0) {
+ /* Encoding failed. Nothing in 'accept_out'. */
+ /* 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;
+ }
- return hnbgw_hnbap_tx(hnb, msg);
+ /* Encoding successful, transmit, then free 'accept_out'. */
+ msg = hnbap_generate_successful_outcome(HNBAP_ProcedureCode_id_UERegister,
+ HNBAP_Criticality_reject,
+ &asn_DEF_HNBAP_UERegisterAccept,
+ &accept_out);
+ rc = hnbgw_hnbap_tx(hnb, msg);
+ ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBAP_UERegisterAccept, &accept_out);
+ return rc;
}
static int hnbgw_rx_hnb_deregister(struct hnb_context *ctx, ANY_t *in)
--
To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32525
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Iad1519aea36d8b6fef51fedb22a861ad1bc462fc
Gerrit-Change-Number: 32525
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: dexter.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/32532 )
Change subject: pySim-shell: fix compatibility problem with cmd2 >= 2.0.0 (Settable)
......................................................................
Patch Set 8: Code-Review-2
(1 comment)
Commit Message:
https://gerrit.osmocom.org/c/pysim/+/32532/comment/0a24453e_6a305891
PS8, Line 11: Older versions will ignore the settable_object parameter
Are you sure? Have you tested this at all? In `requirements.txt` we require `cmd2==1.5`, which does not like this argument. I quickly tested this patch in docker:
```
Card initialization failed with an exception:
---------------------8<---------------------
Traceback (most recent call last):
File "/data/./pySim-shell.py", line 983, in <module>
app = PysimApp(card, rs, sl, ch, opts.script)
File "/data/./pySim-shell.py", line 148, in __init__
self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names', self,
TypeError: __init__() takes 4 positional arguments but 5 positional arguments (and 1 keyword-only argument) were given
---------------------8<---------------------
```
Either we maintain backwards compatibility with 1.5 and don't break it, or we finally bump the version (at least to 0.8.5, which is provided by debian:bullseye).
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/32532
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I38efe4702277ee092a5542d7d659df08cb0adeff
Gerrit-Change-Number: 32532
Gerrit-PatchSet: 8
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 27 Apr 2023 16:30:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment