Skip to contentSkip to conversation

Fix use-after-free

PATCH Applied Denis Grigorev 2 participants 3 messages Jul 30, 2024

lore
Share & tools
lore
#0 lore raw

cover Fix use-after-free

Hi Denis,

It looks like the static analyzer is reporting a false alarm and the recent change is causing a regression, so I suggest reverting one commit.

Denis Grigorev (1):
Revert "cbs: Fix possible NULL dereference"

 src/cbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 Revert "cbs: Fix possible NULL dereference"

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(-)
src/cbs.c +1 -1
index 246157b1..760fd860 100644
@@ -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);
Signature · 1 line
2.17.1
#2 lore raw
In reply to Denis Grigorev
This patch was applied to ofono.git (master) by Denis Kenzior <[email protected]>:

Hello:

This patch was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:

Quoted 10 lines · On Tue, 30 Jul 2024 12:13:31 +0300 you wrote:

Hi Denis,

It looks like the static analyzer is reporting a false alarm and the recent change is causing a regression, so I suggest reverting one commit.

Denis Grigorev (1):
Revert "cbs: Fix possible NULL dereference"

[...]

Here is the summary with links:
- [1/1] Revert "cbs: Fix possible NULL dereference"

    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=91e7548b52b7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html