[PATCH] osmo-bts[master]: Fix race condition in attribute reporting

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Thu Oct 12 13:06:46 UTC 2017


Hello Jenkins Builder, Holger Freyther,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4232

to look at the new patch set (#2).

Fix race condition in attribute reporting

Previously it could be possible that the attribute request comes from
BSC before the TRX is properly initialized which would lead to SIGABRT
caused by OSMO_ASSERT() in PHY instantiation. Workaround this by
explicitly checking for TRX availability before handling TRX-specific
attributes.

This only happens with osmo-bts-trx and is hard to reproduce. Ideal fix
would be to defer attribute response until we have TRX connected but
that would make corresponding code more complex because we'll need to
save the attribute request and properly hook response routine into TRX
connection handler. Alternatively we can postpone osmo-bts-trx
connection to BSC until TRX is available: it's not very useful without
it anyway.

Change-Id: Id36885e507c4a3203b5662c0fde12c5206174d82
Fixes: OS#2560
---
M src/common/oml.c
1 file changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/32/4232/2

diff --git a/src/common/oml.c b/src/common/oml.c
index 69a2642..ff6dc41 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -214,14 +214,23 @@
 		return -ENOMEM;
 
 	for (i = 0; i < attr_len; i++) {
+		bool processed = false;
 		switch (attr[i]) {
 		case NM_ATT_SW_CONFIG:
-			add_trx_attr(attr_buf, trx);
+			if (trx) {
+				add_trx_attr(attr_buf, trx);
+				processed = true;
+			} else
+				LOGP(DOML, LOGL_ERROR, "O&M Get Attributes [%u], %s is unhandled due to missing TRX.\n",
+				     i, get_value_string(abis_nm_att_names, attr[i]));
 			break;
 		default:
 			LOGP(DOML, LOGL_ERROR, "O&M Get Attributes [%u], %s is unsupported by TRX.\n", i,
 			     get_value_string(abis_nm_att_names, attr[i]));
-			out[attr_out_index] = attr[i]; /* assemble values of supported attributes and list of unsupported ones */
+		}
+		/* assemble values of supported attributes and list of unsupported ones */
+		if (!processed) {
+			out[attr_out_index] = attr[i];
 			attr_out_index++;
 		}
 	}

-- 
To view, visit https://gerrit.osmocom.org/4232
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id36885e507c4a3203b5662c0fde12c5206174d82
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list