Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119172
b: refs/heads/master
c: e00b4ff
h: refs/heads/master
v: v3
  • Loading branch information
Nadia Derbey authored and Linus Torvalds committed Nov 20, 2008
1 parent c6ad458 commit 73305e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 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: cf7b9a1e11993a064f445d332fecf22819b87a5e
refs/heads/master: e00b4ff7ebf098b11b11be403921c1cf41d9e321
14 changes: 9 additions & 5 deletions trunk/ipc/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,17 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
if (ids->in_use >= size)
return -ENOSPC;

spin_lock_init(&new->lock);
new->deleted = 0;
rcu_read_lock();
spin_lock(&new->lock);

err = idr_get_new(&ids->ipcs_idr, new, &id);
if (err)
if (err) {
spin_unlock(&new->lock);
rcu_read_unlock();
return err;
}

ids->in_use++;

Expand All @@ -280,10 +288,6 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
ids->seq = 0;

new->id = ipc_buildid(id, new->seq);
spin_lock_init(&new->lock);
new->deleted = 0;
rcu_read_lock();
spin_lock(&new->lock);
return id;
}

Expand Down

0 comments on commit 73305e6

Please sign in to comment.