Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119211
b: refs/heads/master
c: 10db4ef
h: refs/heads/master
i:
  119209: 50a1311
  119207: 22ee6b7
v: v3
  • Loading branch information
Ingo Molnar committed Nov 18, 2008
1 parent 9fb1685 commit 35991ed
Show file tree
Hide file tree
Showing 2 changed files with 22 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: 93ce99e849433ede4ce8b410b749dc0cad1100b2
refs/heads/master: 10db4ef7b9a65b86e4d047671a1886f4c101a859
26 changes: 21 additions & 5 deletions trunk/arch/x86/kernel/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,33 @@ static inline struct ds_context *ds_alloc_context(struct task_struct *task)
struct ds_context *context = *p_context;

if (!context) {
spin_unlock(&ds_lock);

context = kzalloc(sizeof(*context), GFP_KERNEL);

if (!context)
if (!context) {
spin_lock(&ds_lock);
return NULL;
}

context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
if (!context->ds) {
kfree(context);
spin_lock(&ds_lock);
return NULL;
}

spin_lock(&ds_lock);
/*
* Check for race - another CPU could have allocated
* it meanwhile:
*/
if (*p_context) {
kfree(context->ds);
kfree(context);
return *p_context;
}

*p_context = context;

context->this = p_context;
Expand Down Expand Up @@ -384,15 +400,15 @@ static int ds_request(struct task_struct *task, void *base, size_t size,

spin_lock(&ds_lock);

error = -EPERM;
if (!check_tracer(task))
goto out_unlock;

error = -ENOMEM;
context = ds_alloc_context(task);
if (!context)
goto out_unlock;

error = -EPERM;
if (!check_tracer(task))
goto out_unlock;

error = -EALREADY;
if (context->owner[qual] == current)
goto out_unlock;
Expand Down

0 comments on commit 35991ed

Please sign in to comment.