Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

user: port to ns_ref_*() helpers

Stop accessing ns.count directly.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+3 -3
+2 -2
include/linux/user_namespace.h
··· 176 176 static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 177 177 { 178 178 if (ns) 179 - refcount_inc(&ns->ns.count); 179 + ns_ref_inc(ns); 180 180 return ns; 181 181 } 182 182 ··· 186 186 187 187 static inline void put_user_ns(struct user_namespace *ns) 188 188 { 189 - if (ns && refcount_dec_and_test(&ns->ns.count)) 189 + if (ns && ns_ref_put(ns)) 190 190 __put_user_ns(ns); 191 191 } 192 192
+1 -1
kernel/user_namespace.c
··· 225 225 kfree_rcu(ns, ns.ns_rcu); 226 226 dec_user_namespaces(ucounts); 227 227 ns = parent; 228 - } while (refcount_dec_and_test(&parent->ns.count)); 228 + } while (ns_ref_put(parent)); 229 229 } 230 230 231 231 void __put_user_ns(struct user_namespace *ns)