aboutsummaryrefslogtreecommitdiffstats
path: root/src/gb/gprs_ns2_internal.h
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-07-19 03:40:02 +0200
committerlaforge <laforge@osmocom.org>2021-08-13 09:55:51 +0000
commit41589a3e7af0c7ea02785cb113888a96790989dd (patch)
tree12dd51a8a0d951fa9f41f9354926f29b30f78566 /src/gb/gprs_ns2_internal.h
parent1c40525f44455c7da21f87628653321b3fb8d843 (diff)
gprs_ns2: add recursive anchor to protect against double free
When free'ing a NSE/NSVC/BIND ensure there can't be a double free by using a free anchor in the struct. Recursive free's can happen when the NS user reacts on an event (e.g. GPRS_NS2_AFF_CAUSE_VC_FAILURE) and calls the free(). Or when the user free's a NSVC when the NSE uses SNS as configuration, the fsm tries to free it again. Change-Id: If9823aadaa936e136aa43e88cee925ddd5974841
Diffstat (limited to 'src/gb/gprs_ns2_internal.h')
-rw-r--r--src/gb/gprs_ns2_internal.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index db01c2ee..95efbae7 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -215,6 +215,9 @@ struct gprs_ns2_nse {
/*! NSE-wide statistics */
struct rate_ctr_group *ctrg;
+
+ /*! recursive anchor */
+ bool freed;
};
/*! Structure representing a single NS-VC */
@@ -259,6 +262,9 @@ struct gprs_ns2_vc {
enum gprs_ns2_vc_mode mode;
struct osmo_fsm_inst *fi;
+
+ /*! recursive anchor */
+ bool freed;
};
/*! Structure repesenting a bind instance. E.g. IPv4 listen port. */
@@ -303,6 +309,9 @@ struct gprs_ns2_vc_bind {
uint8_t sns_data_weight;
struct osmo_stat_item_group *statg;
+
+ /*! recursive anchor */
+ bool freed;
};
struct gprs_ns2_vc_driver {