diff mbox series

[1/1] Revert "cbs: Fix possible NULL dereference"

Message ID 20240730091332.20031-2-d.grigorev@omp.ru (mailing list archive)
State Accepted
Commit 91e7548b52b722999fd51a8d069410a848c1beba
Headers show
Series Fix use-after-free | expand

Commit Message

Denis Grigorev July 30, 2024, 9:13 a.m. UTC
At the time cbs_unregister() is called, cbs->netreg has already been
cleared in netreg_watch(), so __ofono_modem_remove_atom_watch() is
not called, resulting in a use-after-free later.

This reverts commit 5b528ee0fa699f598995772060e28653897e748f.
---
 src/cbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/cbs.c b/src/cbs.c
index 246157b1..760fd860 100644
--- a/src/cbs.c
+++ b/src/cbs.c
@@ -593,7 +593,7 @@  static void cbs_unregister(struct ofono_atom *atom)
 		cbs->settings = NULL;
 	}
 
-	if (cbs->netreg_watch && cbs->netreg) {
+	if (cbs->netreg_watch) {
 		if (cbs->location_watch) {
 			__ofono_netreg_remove_status_watch(cbs->netreg,
 							cbs->location_watch);