Change in osmo-bsc[master]: VTY: fix NULL-pointer dereference in lchan_act_single()

laforge gerrit-no-reply at lists.osmocom.org
Fri Jun 4 19:39:58 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24540 )

Change subject: VTY: fix NULL-pointer dereference in lchan_act_single()
......................................................................

VTY: fix NULL-pointer dereference in lchan_act_single()

Without this guard, a command like this can crash osmo-bsc:

  OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 activate fr

when timeslot 0 is configured as non-combined 'CCCH'.

Change-Id: I0197a6a2595ff9dade58e37383d44d2df3b03288
CLoses: OS#5170
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 5b1f503..5bd27fc 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -6060,6 +6060,10 @@
 	if (activate) {
 		LOG_LCHAN(lchan, LOGL_NOTICE, "attempt from VTY to activate lchan %s with codec %s\n",
 			  gsm_lchan_name(lchan), codec_str);
+		if (!lchan->fi) {
+			vty_out(vty, "%% Cannot activate: Channel not initialized%s", VTY_NEWLINE);
+			return CMD_WARNING;
+		}
 
 		int lchan_t;
 		if (lchan->fi->state != LCHAN_ST_UNUSED) {

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I0197a6a2595ff9dade58e37383d44d2df3b03288
Gerrit-Change-Number: 24540
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210604/6303f3dd/attachment.htm>


More information about the gerrit-log mailing list