From: Andrew Vagin <avagin@openvz.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kay Sievers <kay.sievers@vrfy.org>
Cc: avagin@openvz.org, linux-hotplug@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] uevent: send events in correct order according to seqnum
Date: Wed, 7 Mar 2012 00:06:08 +0400 [thread overview]
Message-ID: <1331064368-55675-1-git-send-email-avagin@openvz.org> (raw)
In-Reply-To: <CAPXgP10GRZ6Y3+dtNSw5zQMaM9FnSBBfLrCJmQ948gA3tALtfw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 493 bytes --]
The queue handling in the udev daemon assumes that the events are
ordered.
Before this patch uevent_seqnum is incremented under sequence_lock,
than an event is send uner uevent_sock_mutex. I want to say that code
contained a window between incrementing seqnum and sending an event.
This patch locks uevent_sock_mutex before incrementing uevent_seqnum.
Signed-off-by: Andrew Vagin <avagin@openvz.org>
---
lib/kobject_uevent.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-uevent-send-events-in-correct-order-according-to-seq.patch --]
[-- Type: text/x-patch; name="0001-uevent-send-events-in-correct-order-according-to-seq.patch", Size: 798 bytes --]
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index e66e9b6..596c40d 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -243,6 +243,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
else if (action == KOBJ_REMOVE)
kobj->state_remove_uevent_sent = 1;
+#if defined(CONFIG_NET)
+ mutex_lock(&uevent_sock_mutex);
+#endif
/* we will send an event, so request a new sequence number */
spin_lock(&sequence_lock);
seq = ++uevent_seqnum;
@@ -253,7 +256,6 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
#if defined(CONFIG_NET)
/* send netlink message */
- mutex_lock(&uevent_sock_mutex);
list_for_each_entry(ue_sk, &uevent_sock_list, list) {
struct sock *uevent_sock = ue_sk->sk;
struct sk_buff *skb;
next parent reply other threads:[~2012-03-06 20:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAPXgP10GRZ6Y3+dtNSw5zQMaM9FnSBBfLrCJmQ948gA3tALtfw@mail.gmail.com>
2012-03-06 20:06 ` Andrew Vagin [this message]
2012-03-06 21:03 ` Kay Sievers
2012-03-06 21:14 ` avagin
2012-03-07 5:52 ` Greg Kroah-Hartman
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=1331064368-55675-1-git-send-email-avagin@openvz.org \
--to=avagin@openvz.org \
--cc=gregkh@linuxfoundation.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-hotplug@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®