From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, Ivo van Doorn <ivdoorn@gmail.com>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
Ivo van Doorn <IvDoorn@gmail.com>
Subject: [PATCH 1/4] rfkill: minor locking fix
Date: Fri, 27 Mar 2009 12:44:08 -0300 [thread overview]
Message-ID: <1238168651-28891-2-git-send-email-hmh@hmh.eng.br> (raw)
In-Reply-To: <1238168651-28891-1-git-send-email-hmh@hmh.eng.br>
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@hmh.eng.br>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
---
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
next prev parent reply other threads:[~2009-03-27 15:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-27 15:44 [GIT PATCH] rfkill updates Henrique de Moraes Holschuh
2009-03-27 15:44 ` Henrique de Moraes Holschuh [this message]
2009-03-27 15:44 ` [PATCH 2/4] rfkill: status initialization paranoia Henrique de Moraes Holschuh
2009-03-27 15:44 ` [PATCH 3/4] rfkill: defensive use of test_bit Henrique de Moraes Holschuh
2009-03-27 15:44 ` [PATCH 4/4] rfkill: allow embedded config without an userspace API Henrique de Moraes Holschuh
2009-03-27 21:33 ` [GIT PATCH] rfkill updates Johannes Berg
2009-03-28 12:36 ` Henrique de Moraes Holschuh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1238168651-28891-2-git-send-email-hmh@hmh.eng.br \
--to=hmh@hmh.eng.br \
--cc=ivdoorn@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox