diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-05-04 20:36:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 12:37:33 -0400 |
commit | 417daa1e8f893fbac88fd395340ba7779fd3926c (patch) | |
tree | b712bd9f19a07f648df2e420e862684bde3a8a32 /lib | |
parent | 5f71a29629b4717445f8b7f5fb8f50c2d262b68e (diff) |
hotplug: netns aware uevent_helper
It only makes sense for uevent_helper to get events
in the intial namespaces. It's invocation is not
per namespace and it is not clear how we could make
it's invocation namespace aware.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kobject_uevent.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 239c8e83fc28..59c15511d58a 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/kobject.h> | 19 | #include <linux/kobject.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | 22 | #include <linux/user_namespace.h> | |
23 | #include <linux/socket.h> | 23 | #include <linux/socket.h> |
24 | #include <linux/skbuff.h> | 24 | #include <linux/skbuff.h> |
25 | #include <linux/netlink.h> | 25 | #include <linux/netlink.h> |
@@ -99,6 +99,21 @@ static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data) | |||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | static int kobj_usermode_filter(struct kobject *kobj) | ||
103 | { | ||
104 | const struct kobj_ns_type_operations *ops; | ||
105 | |||
106 | ops = kobj_ns_ops(kobj); | ||
107 | if (ops) { | ||
108 | const void *init_ns, *ns; | ||
109 | ns = kobj->ktype->namespace(kobj); | ||
110 | init_ns = ops->initial_ns(); | ||
111 | return ns != init_ns; | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
102 | /** | 117 | /** |
103 | * kobject_uevent_env - send an uevent with environmental data | 118 | * kobject_uevent_env - send an uevent with environmental data |
104 | * | 119 | * |
@@ -274,7 +289,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
274 | #endif | 289 | #endif |
275 | 290 | ||
276 | /* call uevent_helper, usually only enabled during early boot */ | 291 | /* call uevent_helper, usually only enabled during early boot */ |
277 | if (uevent_helper[0]) { | 292 | if (uevent_helper[0] && !kobj_usermode_filter(kobj)) { |
278 | char *argv [3]; | 293 | char *argv [3]; |
279 | 294 | ||
280 | argv [0] = uevent_helper; | 295 | argv [0] = uevent_helper; |