Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176690
b: refs/heads/master
c: bf17bb7
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Dec 16, 2009
1 parent 24187a7 commit 53d1ac8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 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: 7d6feeb287c61aafa88f06345387b1188edf4b86
refs/heads/master: bf17bb717759d50a2733a7a8157a7c4a25d93abc
26 changes: 20 additions & 6 deletions trunk/ipc/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,17 +962,31 @@ static inline int get_undo_list(struct sem_undo_list **undo_listp)
return 0;
}

static struct sem_undo *lookup_undo(struct sem_undo_list *ulp, int semid)
static struct sem_undo *__lookup_undo(struct sem_undo_list *ulp, int semid)
{
struct sem_undo *walk;
struct sem_undo *un;

list_for_each_entry_rcu(walk, &ulp->list_proc, list_proc) {
if (walk->semid == semid)
return walk;
list_for_each_entry_rcu(un, &ulp->list_proc, list_proc) {
if (un->semid == semid)
return un;
}
return NULL;
}

static struct sem_undo *lookup_undo(struct sem_undo_list *ulp, int semid)
{
struct sem_undo *un;

assert_spin_locked(&ulp->lock);

un = __lookup_undo(ulp, semid);
if (un) {
list_del_rcu(&un->list_proc);
list_add_rcu(&un->list_proc, &ulp->list_proc);
}
return un;
}

/**
* find_alloc_undo - Lookup (and if not present create) undo array
* @ns: namespace
Expand Down Expand Up @@ -1308,7 +1322,7 @@ void exit_sem(struct task_struct *tsk)
if (IS_ERR(sma))
continue;

un = lookup_undo(ulp, semid);
un = __lookup_undo(ulp, semid);
if (un == NULL) {
/* exit_sem raced with IPC_RMID+semget() that created
* exactly the same semid. Nothing to do.
Expand Down

0 comments on commit 53d1ac8

Please sign in to comment.