aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/kobject_uevent.c19
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
102static 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;