diff options
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | include/linux/user_namespace.h | 2 | ||||
-rw-r--r-- | kernel/user.c | 15 | ||||
-rw-r--r-- | kernel/user_namespace.c | 2 |
4 files changed, 11 insertions, 10 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index f4e324ed2e44..6239bc2c2baa 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -593,7 +593,7 @@ struct user_struct { | |||
593 | #endif | 593 | #endif |
594 | 594 | ||
595 | /* Hash table maintenance information */ | 595 | /* Hash table maintenance information */ |
596 | struct list_head uidhash_list; | 596 | struct hlist_node uidhash_node; |
597 | uid_t uid; | 597 | uid_t uid; |
598 | }; | 598 | }; |
599 | 599 | ||
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index 1101b0ce878f..b5f41d4c2eec 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | struct user_namespace { | 12 | struct user_namespace { |
13 | struct kref kref; | 13 | struct kref kref; |
14 | struct list_head uidhash_table[UIDHASH_SZ]; | 14 | struct hlist_head uidhash_table[UIDHASH_SZ]; |
15 | struct user_struct *root_user; | 15 | struct user_struct *root_user; |
16 | }; | 16 | }; |
17 | 17 | ||
diff --git a/kernel/user.c b/kernel/user.c index e080ba863ae3..add57c7e4c07 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -55,21 +55,22 @@ struct user_struct root_user = { | |||
55 | /* | 55 | /* |
56 | * These routines must be called with the uidhash spinlock held! | 56 | * These routines must be called with the uidhash spinlock held! |
57 | */ | 57 | */ |
58 | static inline void uid_hash_insert(struct user_struct *up, struct list_head *hashent) | 58 | static inline void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent) |
59 | { | 59 | { |
60 | list_add(&up->uidhash_list, hashent); | 60 | hlist_add_head(&up->uidhash_node, hashent); |
61 | } | 61 | } |
62 | 62 | ||
63 | static inline void uid_hash_remove(struct user_struct *up) | 63 | static inline void uid_hash_remove(struct user_struct *up) |
64 | { | 64 | { |
65 | list_del(&up->uidhash_list); | 65 | hlist_del(&up->uidhash_node); |
66 | } | 66 | } |
67 | 67 | ||
68 | static inline struct user_struct *uid_hash_find(uid_t uid, struct list_head *hashent) | 68 | static inline struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent) |
69 | { | 69 | { |
70 | struct user_struct *user; | 70 | struct user_struct *user; |
71 | struct hlist_node *h; | ||
71 | 72 | ||
72 | list_for_each_entry(user, hashent, uidhash_list) { | 73 | hlist_for_each_entry(user, h, hashent, uidhash_node) { |
73 | if(user->uid == uid) { | 74 | if(user->uid == uid) { |
74 | atomic_inc(&user->__count); | 75 | atomic_inc(&user->__count); |
75 | return user; | 76 | return user; |
@@ -118,7 +119,7 @@ void free_uid(struct user_struct *up) | |||
118 | 119 | ||
119 | struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid) | 120 | struct user_struct * alloc_uid(struct user_namespace *ns, uid_t uid) |
120 | { | 121 | { |
121 | struct list_head *hashent = uidhashentry(ns, uid); | 122 | struct hlist_head *hashent = uidhashentry(ns, uid); |
122 | struct user_struct *up; | 123 | struct user_struct *up; |
123 | 124 | ||
124 | spin_lock_irq(&uidhash_lock); | 125 | spin_lock_irq(&uidhash_lock); |
@@ -207,7 +208,7 @@ static int __init uid_cache_init(void) | |||
207 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | 208 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); |
208 | 209 | ||
209 | for(n = 0; n < UIDHASH_SZ; ++n) | 210 | for(n = 0; n < UIDHASH_SZ; ++n) |
210 | INIT_LIST_HEAD(init_user_ns.uidhash_table + n); | 211 | INIT_HLIST_HEAD(init_user_ns.uidhash_table + n); |
211 | 212 | ||
212 | /* Insert the root user immediately (init already runs as root) */ | 213 | /* Insert the root user immediately (init already runs as root) */ |
213 | spin_lock_irq(&uidhash_lock); | 214 | spin_lock_irq(&uidhash_lock); |
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index 85af9422ea6e..e7ba1bf8457c 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -39,7 +39,7 @@ static struct user_namespace *clone_user_ns(struct user_namespace *old_ns) | |||
39 | kref_init(&ns->kref); | 39 | kref_init(&ns->kref); |
40 | 40 | ||
41 | for (n = 0; n < UIDHASH_SZ; ++n) | 41 | for (n = 0; n < UIDHASH_SZ; ++n) |
42 | INIT_LIST_HEAD(ns->uidhash_table + n); | 42 | INIT_HLIST_HEAD(ns->uidhash_table + n); |
43 | 43 | ||
44 | /* Insert new root user. */ | 44 | /* Insert new root user. */ |
45 | ns->root_user = alloc_uid(ns, 0); | 45 | ns->root_user = alloc_uid(ns, 0); |