All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sim: handling crash in error scenario for SIM PIN query
@ 2019-12-19 12:57 Antara Borwankar
  2019-12-20 18:46 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Antara Borwankar @ 2019-12-19 12:57 UTC (permalink / raw)
  To: ofono

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

In case of error in sim_pin_query_cb function. pin_type is set
to -1. This is causing segmentation fault in function
sim_passwd_name due to invalid index pin_type = -1. Fixing this
issue by handling error case before calling sim_passwd_name
function.
---
 src/sim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/sim.c b/src/sim.c
index 535ccbc..33e1245 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -3201,7 +3201,7 @@ static void sim_pin_query_cb(const struct ofono_error *error,
 	DBusConnection *conn = ofono_dbus_get_connection();
 	const char *path = __ofono_atom_get_path(sim->atom);
 	struct cached_pin *cpins = pin_cache_lookup(sim->iccid);
-	const char *pin_name = sim_passwd_name(pin_type);
+	const char *pin_name;
 	char **locked_pins;
 	gboolean lock_changed;
 
@@ -3212,6 +3212,8 @@ static void sim_pin_query_cb(const struct ofono_error *error,
 		return;
 	}
 
+	pin_name = sim_passwd_name(pin_type);
+
 	if (sim->pin_type != pin_type) {
 		sim->pin_type = pin_type;
 
-- 
1.9.1

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

* Re: [PATCH] sim: handling crash in error scenario for SIM PIN query
  2019-12-19 12:57 [PATCH] sim: handling crash in error scenario for SIM PIN query Antara Borwankar
@ 2019-12-20 18:46 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2019-12-20 18:46 UTC (permalink / raw)
  To: ofono

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

Hi Antara,

On 12/19/19 6:57 AM, Antara Borwankar wrote:
> In case of error in sim_pin_query_cb function. pin_type is set
> to -1. This is causing segmentation fault in function
> sim_passwd_name due to invalid index pin_type = -1. Fixing this
> issue by handling error case before calling sim_passwd_name
> function.
> ---
>   src/sim.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 

Applied, thanks.

Regards,
-Denis

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

end of thread, other threads:[~2019-12-20 18:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19 12:57 [PATCH] sim: handling crash in error scenario for SIM PIN query Antara Borwankar
2019-12-20 18:46 ` 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.