diff options
Diffstat (limited to 'lib')
-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; |