[MERGED] libosmocore[master]: lapd_dl_flush_hist(): Don't flush a non-existant history

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jul 4 08:34:58 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: lapd_dl_flush_hist(): Don't flush a non-existant history
......................................................................


lapd_dl_flush_hist(): Don't flush a non-existant history

If lapd_dl_flush_hist() is called after lapd_dl_exit(), dl->tx_hist has
already been free'd and set to NULL.  Check for this before attempting
to de-reference a NULL pointer.

This bug breaks OpenBSC with any E1 based BTSs using DAHDI.

Change-Id: I117ba3445fa5e8097e21c11c5a6337de6ba46c7d
Related: OS#1760
---
M src/gsm/lapd_core.c
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index c59b075..fd1e709 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -158,6 +158,9 @@
 {
 	unsigned int i;
 
+	if (!dl->range_hist)
+		return;
+
 	for (i = 0; i < dl->range_hist; i++) {
 		if (dl->tx_hist[i].msg) {
 			msgb_free(dl->tx_hist[i].msg);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I117ba3445fa5e8097e21c11c5a6337de6ba46c7d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list