From 5d5c34c36f76aae86738292449d3d8b70e580707 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 16 Mar 2010 15:14:51 +1100 Subject: [PATCH] --- yaml --- r: 196035 b: refs/heads/master c: db1afffab0b5d9f6d31f8f4bea44c9cb3bc59351 h: refs/heads/master i: 196033: 525c76bc5184924f4695a8f687e7f40474535fb9 196031: 00463a6e48275c3d69e4b8168f70ccee5be342f5 v: v3 --- [refs] | 2 +- trunk/include/linux/kref.h | 1 - trunk/kernel/user_namespace.c | 4 ++-- trunk/lib/kref.c | 15 ++------------- trunk/security/integrity/ima/ima_iint.c | 4 ++-- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/[refs] b/[refs] index 7c9d4b5c2e01..fa78cd7b5524 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dd336c554d8926c3348a2d5f2a5ef5597f6d1a06 +refs/heads/master: db1afffab0b5d9f6d31f8f4bea44c9cb3bc59351 diff --git a/trunk/include/linux/kref.h b/trunk/include/linux/kref.h index baf4b9e4b194..6cc38fc07ab7 100644 --- a/trunk/include/linux/kref.h +++ b/trunk/include/linux/kref.h @@ -21,7 +21,6 @@ struct kref { atomic_t refcount; }; -void kref_set(struct kref *kref, int num); void kref_init(struct kref *kref); void kref_get(struct kref *kref); int kref_put(struct kref *kref, void (*release) (struct kref *kref)); diff --git a/trunk/kernel/user_namespace.c b/trunk/kernel/user_namespace.c index 076c7c8215b0..b2d70d38dff4 100644 --- a/trunk/kernel/user_namespace.c +++ b/trunk/kernel/user_namespace.c @@ -54,8 +54,8 @@ int create_user_ns(struct cred *new) #endif /* tgcred will be cleared in our caller bc CLONE_THREAD won't be set */ - /* alloc_uid() incremented the userns refcount. Just set it to 1 */ - kref_set(&ns->kref, 1); + /* root_user holds a reference to ns, our reference can be dropped */ + put_user_ns(ns); return 0; } diff --git a/trunk/lib/kref.c b/trunk/lib/kref.c index 6d19f690380b..d3d227a08a4b 100644 --- a/trunk/lib/kref.c +++ b/trunk/lib/kref.c @@ -15,24 +15,14 @@ #include #include -/** - * kref_set - initialize object and set refcount to requested number. - * @kref: object in question. - * @num: initial reference counter - */ -void kref_set(struct kref *kref, int num) -{ - atomic_set(&kref->refcount, num); - smp_mb(); -} - /** * kref_init - initialize object. * @kref: object in question. */ void kref_init(struct kref *kref) { - kref_set(kref, 1); + atomic_set(&kref->refcount, 1); + smp_mb(); } /** @@ -72,7 +62,6 @@ int kref_put(struct kref *kref, void (*release)(struct kref *kref)) return 0; } -EXPORT_SYMBOL(kref_set); EXPORT_SYMBOL(kref_init); EXPORT_SYMBOL(kref_get); EXPORT_SYMBOL(kref_put); diff --git a/trunk/security/integrity/ima/ima_iint.c b/trunk/security/integrity/ima/ima_iint.c index 2dc2d6594145..7625b85c2274 100644 --- a/trunk/security/integrity/ima/ima_iint.c +++ b/trunk/security/integrity/ima/ima_iint.c @@ -94,7 +94,7 @@ void iint_free(struct kref *kref) iint->opencount); iint->opencount = 0; } - kref_set(&iint->refcount, 1); + kref_init(&iint->refcount); kmem_cache_free(iint_cache, iint); } @@ -133,7 +133,7 @@ static void init_once(void *foo) iint->readcount = 0; iint->writecount = 0; iint->opencount = 0; - kref_set(&iint->refcount, 1); + kref_init(&iint->refcount); } static int __init ima_iintcache_init(void)