Review at  https://gerrit.osmocom.org/6684

host/trxcon: fix NULL-pointer deference

Change-Id: Idc036d4ea32b4aa3f4841d39144ef1733414728e
---
M src/host/trxcon/l1ctl_link.c
M src/host/trxcon/trx_if.c
2 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/84/6684/1

diff --git a/src/host/trxcon/l1ctl_link.c b/src/host/trxcon/l1ctl_link.c
index e52950f..62e8943 100644
--- a/src/host/trxcon/l1ctl_link.c
+++ b/src/host/trxcon/l1ctl_link.c
@@ -247,6 +247,10 @@
 {
        struct osmo_fd *listen_bfd;
 
+       /* May be unallocated due to init error */
+       if (!l1l)
+               return;
+
        LOGP(DL1C, LOGL_NOTICE, "Shutdown L1CTL link\n");
 
        listen_bfd = &l1l->listen_bfd;
diff --git a/src/host/trxcon/trx_if.c b/src/host/trxcon/trx_if.c
index 0607167..9ae4900 100644
--- a/src/host/trxcon/trx_if.c
+++ b/src/host/trxcon/trx_if.c
@@ -592,6 +592,10 @@
 
 void trx_if_close(struct trx_instance *trx)
 {
+       /* May be unallocated due to init error */
+       if (!trx)
+               return;
+
        LOGP(DTRX, LOGL_NOTICE, "Shutdown transceiver interface\n");
 
        /* Flush CTRL message list */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc036d4ea32b4aa3f4841d39144ef1733414728e
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to