All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix crash when PUK is required
@ 2016-04-20  8:09 caiwen.zhang
  2016-04-21  2:28 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: caiwen.zhang @ 2016-04-20  8:09 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1957 bytes --]

From: Caiwen Zhang <caiwen.zhang@intel.com>

After input PIN wrong 3 times, sim main state (include spn_watches)
is freed. but the watch id still be kept by other atoms (network and
gprs), when remove the atom, it will try to remove the watch from
spn_watches, ofono daemon will crash.
---
 src/sim.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/sim.c b/src/sim.c
index e1c1809..bcf5afd 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1840,7 +1840,6 @@ static void sim_efphase_read_cb(int ok, int length, int record,
 static void sim_initialize_after_pin(struct ofono_sim *sim)
 {
 	sim->context = ofono_sim_context_create(sim);
-	sim->spn_watches = __ofono_watchlist_new(g_free);
 
 	ofono_sim_read(sim->context, SIM_EFPHASE_FILEID,
 			OFONO_SIM_FILE_STRUCTURE_TRANSPARENT,
@@ -2348,11 +2347,6 @@ static void sim_free_early_state(struct ofono_sim *sim)
 
 static void sim_spn_close(struct ofono_sim *sim)
 {
-	if (sim->spn_watches) {
-		__ofono_watchlist_free(sim->spn_watches);
-		sim->spn_watches = NULL;
-	}
-
 	/*
 	 * We have not initialized SPN logic at all yet, either because
 	 * no netreg / gprs atom has been needed or we have not reached the
@@ -2881,6 +2875,8 @@ static void sim_unregister(struct ofono_atom *atom)
 
 	__ofono_watchlist_free(sim->state_watches);
 	sim->state_watches = NULL;
+	__ofono_watchlist_free(sim->spn_watches);
+	sim->spn_watches = NULL;
 
 	g_dbus_unregister_interface(conn, path, OFONO_SIM_MANAGER_INTERFACE);
 	ofono_modem_remove_interface(modem, OFONO_SIM_MANAGER_INTERFACE);
@@ -3011,6 +3007,7 @@ void ofono_sim_register(struct ofono_sim *sim)
 
 	ofono_modem_add_interface(modem, OFONO_SIM_MANAGER_INTERFACE);
 	sim->state_watches = __ofono_watchlist_new(g_free);
+	sim->spn_watches = __ofono_watchlist_new(g_free);
 	sim->simfs = sim_fs_new(sim, sim->driver);
 
 	__ofono_atom_register(sim->atom, sim_unregister);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix crash when PUK is required
  2016-04-20  8:09 [PATCH] Fix crash when PUK is required caiwen.zhang
@ 2016-04-21  2:28 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2016-04-21  2:28 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

Hi Caiwen,

On 04/20/2016 03:09 AM, caiwen.zhang(a)intel.com wrote:
> From: Caiwen Zhang <caiwen.zhang@intel.com>
>
> After input PIN wrong 3 times, sim main state (include spn_watches)
> is freed. but the watch id still be kept by other atoms (network and
> gprs), when remove the atom, it will try to remove the watch from
> spn_watches, ofono daemon will crash.
> ---
>   src/sim.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
>

Applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-21  2:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-20  8:09 [PATCH] Fix crash when PUK is required caiwen.zhang
2016-04-21  2:28 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.