Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131839
b: refs/heads/master
c: 5170836
h: refs/heads/master
i:
  131837: 9f1f17e
  131835: f15a427
  131831: 041b968
  131823: 90bb2ac
  131807: 75c9a84
  131775: efc987e
  131711: 0beeec3
  131583: 6e8b1d1
v: v3
  • Loading branch information
David Howells authored and Linus Torvalds committed Feb 28, 2009
1 parent e0a71e7 commit 7aaa654
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ca2f156b06bdcbfd1ab543355279246d05e2499
refs/heads/master: 5170836679185357dc1b7660bad13287b39e1e33
1 change: 1 addition & 0 deletions trunk/include/linux/user_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct user_namespace {
struct kref kref;
struct hlist_head uidhash_table[UIDHASH_SZ];
struct user_struct *creator;
struct work_struct destroyer;
};

extern struct user_namespace init_user_ns;
Expand Down
21 changes: 17 additions & 4 deletions trunk/kernel/user_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,25 @@ int create_user_ns(struct cred *new)
return 0;
}

void free_user_ns(struct kref *kref)
/*
* Deferred destructor for a user namespace. This is required because
* free_user_ns() may be called with uidhash_lock held, but we need to call
* back to free_uid() which will want to take the lock again.
*/
static void free_user_ns_work(struct work_struct *work)
{
struct user_namespace *ns;

ns = container_of(kref, struct user_namespace, kref);
struct user_namespace *ns =
container_of(work, struct user_namespace, destroyer);
free_uid(ns->creator);
kfree(ns);
}

void free_user_ns(struct kref *kref)
{
struct user_namespace *ns =
container_of(kref, struct user_namespace, kref);

INIT_WORK(&ns->destroyer, free_user_ns_work);
schedule_work(&ns->destroyer);
}
EXPORT_SYMBOL(free_user_ns);

0 comments on commit 7aaa654

Please sign in to comment.