Skip to content

Commit

Permalink
sim: fix segfault in sim atom
Browse files Browse the repository at this point in the history
While adding the sim pin cache feature, pin_name could cause issue in
cases when sim pin is not there.

log:
ofonod[27810]: drivers/atmodem/sim.c:at_cpin_cb() crsm_pin_cb: READY
ofonod[27810]: src/sim.c:sim_pin_query_cb() sim->pin_type: 0, pin_type: 0
ofonod[27810]: Aborting (signal 11) [./src/ofonod]
ofonod[27810]: ++++++++ backtrace ++++++++
ofonod[27810]: #0  0x7fb7a7586cb0 in /lib/x86_64-linux-gnu/libc.so.6
ofonod[27810]: #1  0x7fb7a7693cd8 in /lib/x86_64-linux-gnu/libc.so.6
ofonod[27810]: sailfish-on-dontbeevil#2  0x4d899b in sim_pin_query_cb() at src/sim.c:3174
ofonod[27810]: sailfish-on-dontbeevil#3  0x4649e7 in at_cpin_cb() at drivers/atmodem/sim.c:1304
ofonod[27810]: sailfish-on-dontbeevil#4  0x4a5d70 in at_chat_finish_command() at gatchat/gatchat.c:462
  • Loading branch information
agargi-intel authored and piggz committed Mar 11, 2022
1 parent 81c7f88 commit c779a8b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ofono/src/sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -3300,7 +3300,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;
const char *pin_name = sim_passwd_name(pin_type);
char **locked_pins;
gboolean lock_changed;

Expand All @@ -3313,7 +3313,6 @@ static void sim_pin_query_cb(const struct ofono_error *error,

if (sim->pin_type != pin_type) {
sim->pin_type = pin_type;
pin_name = sim_passwd_name(pin_type);

if (pin_type != OFONO_SIM_PASSWORD_NONE &&
password_is_pin(pin_type) == FALSE)
Expand Down

0 comments on commit c779a8b

Please sign in to comment.