Commit 74099b18 authored by Kay Sievers's avatar Kay Sievers Committed by Greg Kroah-Hartman

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: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cf6a2eac
...@@ -259,6 +259,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, ...@@ -259,6 +259,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
struct sk_buff *skb; struct sk_buff *skb;
size_t len; size_t len;
if (!netlink_has_listeners(uevent_sock, 1))
continue;
/* allocate message with the maximum possible size */ /* allocate message with the maximum possible size */
len = strlen(action_string) + strlen(devpath) + 2; len = strlen(action_string) + strlen(devpath) + 2;
skb = alloc_skb(len + env->buflen, GFP_KERNEL); skb = alloc_skb(len + env->buflen, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment