diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2010-05-04 20:36:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 12:37:32 -0400 |
commit | 5f71a29629b4717445f8b7f5fb8f50c2d262b68e (patch) | |
tree | 75884ccf4d2ea28407643742742b0ccab5c74292 /lib/kobject_uevent.c | |
parent | 910a7e905f36e51a17d6e8bb4ad6dcd5ac5f1d53 (diff) |
kobj: Send hotplug events in the proper namespace.
Utilize netlink_broacast_filtered to allow sending hotplug events
in the proper namespace.
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/kobject_uevent.c')
-rw-r--r-- | lib/kobject_uevent.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index 9084f2550c2a..239c8e83fc28 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c | |||
@@ -83,6 +83,22 @@ out: | |||
83 | return ret; | 83 | return ret; |
84 | } | 84 | } |
85 | 85 | ||
86 | static int kobj_bcast_filter(struct sock *dsk, struct sk_buff *skb, void *data) | ||
87 | { | ||
88 | struct kobject *kobj = data; | ||
89 | const struct kobj_ns_type_operations *ops; | ||
90 | |||
91 | ops = kobj_ns_ops(kobj); | ||
92 | if (ops) { | ||
93 | const void *sock_ns, *ns; | ||
94 | ns = kobj->ktype->namespace(kobj); | ||
95 | sock_ns = ops->netlink_ns(dsk); | ||
96 | return sock_ns != ns; | ||
97 | } | ||
98 | |||
99 | return 0; | ||
100 | } | ||
101 | |||
86 | /** | 102 | /** |
87 | * kobject_uevent_env - send an uevent with environmental data | 103 | * kobject_uevent_env - send an uevent with environmental data |
88 | * | 104 | * |
@@ -244,8 +260,10 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, | |||
244 | } | 260 | } |
245 | 261 | ||
246 | NETLINK_CB(skb).dst_group = 1; | 262 | NETLINK_CB(skb).dst_group = 1; |
247 | retval = netlink_broadcast(uevent_sock, skb, 0, 1, | 263 | retval = netlink_broadcast_filtered(uevent_sock, skb, |
248 | GFP_KERNEL); | 264 | 0, 1, GFP_KERNEL, |
265 | kobj_bcast_filter, | ||
266 | kobj); | ||
249 | /* ENOBUFS should be handled in userspace */ | 267 | /* ENOBUFS should be handled in userspace */ |
250 | if (retval == -ENOBUFS) | 268 | if (retval == -ENOBUFS) |
251 | retval = 0; | 269 | retval = 0; |