aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kobject_uevent.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-12-05 13:12:47 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-09 19:23:50 -0500
commit74099b18b8db0670484e0caeb3425fb29ff3144e (patch)
treea50f4085ab7e8d04936a886c7a4f6a535a32ed5d /lib/kobject_uevent.c
parentcf6a2eacbcb2593b5b91d0817915c4f0464bb534 (diff)
driver-core: skip uevent generation when nobody is listening
Most network namespaces unlikely have listeners to uevents, and should benefit from skipping all the string copies. Cc: Eric Biederman <ebiederm@xmission.com> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib/kobject_uevent.c')
-rw-r--r--lib/kobject_uevent.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index ad72a03ce5e9..e66e9b632617 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -259,6 +259,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
259 struct sk_buff *skb; 259 struct sk_buff *skb;
260 size_t len; 260 size_t len;
261 261
262 if (!netlink_has_listeners(uevent_sock, 1))
263 continue;
264
262 /* allocate message with the maximum possible size */ 265 /* allocate message with the maximum possible size */
263 len = strlen(action_string) + strlen(devpath) + 2; 266 len = strlen(action_string) + strlen(devpath) + 2;
264 skb = alloc_skb(len + env->buflen, GFP_KERNEL); 267 skb = alloc_skb(len + env->buflen, GFP_KERNEL);