The API requires that we lock rfkill->mutex before we call rfkill_toggle_radio(). We weren't doing it in rfkill_add_switch(), which is part of the rfkill_register() code flow. It is higly unlikely that something would access the rfkill struct while it is not even registered yet, so this is not a bug I would ever expect to see triggered. Still, there is no reason to not fix anyway and thus always enforce the API. Signed-off-by: Henrique de Moraes Holschuh <hmh@xxxxxxxxxx> Cc: Ivo van Doorn <IvDoorn@xxxxxxxxx> --- net/rfkill/rfkill.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 3eaa394..f00df8c 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c @@ -629,9 +629,11 @@ static int rfkill_add_switch(struct rfkill *rfkill) rfkill_global_states[rfkill->type].default_state; } + mutex_lock(&rfkill->mutex); rfkill_toggle_radio(rfkill, rfkill_global_states[rfkill->type].current_state, 0); + mutex_unlock(&rfkill->mutex); list_add_tail(&rfkill->node, &rfkill_list); -- 1.6.2.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html