Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2019-02-14 18:06:38 +0100
committerMichal Kubecek <mkubecek@suse.cz>2019-02-14 18:06:38 +0100
commitdeae19cbd0b7d464238fb3edf11a5e05854b07ec (patch)
tree42d8e2719bf76e3a1471be3a048ef77946585cb4
parent9392b06cc082bdfba9a8da334244bd7c7c95d117 (diff)
net: add uevent socket member (bsc#1122982).
-rw-r--r--include/net/net_namespace.h4
-rw-r--r--lib/kobject_uevent.c17
2 files changed, 10 insertions, 11 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index e733f115515e..cd8838e918e7 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -38,7 +38,7 @@ struct net_device;
struct sock;
struct ctl_table_header;
struct net_generic;
-struct sock;
+struct uevent_sock;
struct netns_ipvs;
@@ -77,6 +77,8 @@ struct net {
struct sock *rtnl; /* rtnetlink socket */
struct sock *genl_sock;
+ struct uevent_sock *uevent_sock; /* uevent socket */
+
struct list_head dev_base_head;
struct hlist_head *dev_name_head;
struct hlist_head *dev_index_head;
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index cdde3db2481b..49c84790f65f 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -31,11 +31,13 @@ u64 uevent_seqnum;
#ifdef CONFIG_UEVENT_HELPER
char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH;
#endif
-#ifdef CONFIG_NET
+
struct uevent_sock {
struct list_head list;
struct sock *sk;
};
+
+#ifdef CONFIG_NET
static LIST_HEAD(uevent_sock_list);
#endif
@@ -438,6 +440,9 @@ static int uevent_net_init(struct net *net)
kfree(ue_sk);
return -ENODEV;
}
+
+ net->uevent_sock = ue_sk;
+
mutex_lock(&uevent_sock_mutex);
list_add_tail(&ue_sk->list, &uevent_sock_list);
mutex_unlock(&uevent_sock_mutex);
@@ -446,17 +451,9 @@ static int uevent_net_init(struct net *net)
static void uevent_net_exit(struct net *net)
{
- struct uevent_sock *ue_sk;
+ struct uevent_sock *ue_sk = net->uevent_sock;
mutex_lock(&uevent_sock_mutex);
- list_for_each_entry(ue_sk, &uevent_sock_list, list) {
- if (sock_net(ue_sk->sk) == net)
- goto found;
- }
- mutex_unlock(&uevent_sock_mutex);
- return;
-
-found:
list_del(&ue_sk->list);
mutex_unlock(&uevent_sock_mutex);