Skip to contentSkip to conversation

x86, bts: fix unlock problem in ds.c

PATCH Applied Markus Metzger 3 participants 5 messages Nov 15, 2008 – Nov 20, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, bts: fix unlock problem in ds.c

Fix a problem where ds_request() returned an error without releasing the ds lock.

---

arch/x86/kernel/ds.c +2 -1
Index: gits/arch/x86/kernel/ds.c
===================================================================
@@ -384,8 +384,9 @@
 
 	spin_lock(&ds_lock);
 
+	error = -EPERM;
 	if (!check_tracer(task))
-		return -EPERM;
+		goto out_unlock;
 
 	error = -ENOMEM;
 	context = ds_alloc_context(task);
#2 lore raw
In reply to Markus Metzger

Markus,

I think this patch is not quite right. You don't want to go out via out_unlock because you're going to call ds_put_context)() when you did not invoke the matching ds_get_context() (hidden in ds_alloc_context). It happens later in the ds_request() function.

Quoted 25 lines · Markus Metzger

Fix a problem where ds_request() returned an error without releasing the ds lock.

---

Index: gits/arch/x86/kernel/ds.c
===================================================================

arch/x86/kernel/ds.c 2008-11-15 10:53:43.000000000 +0100 renamed from arch/x86/kernel/ds.c 2008-11-15 10:51:51.000000000 +0100 +2 -1
@@ -384,8 +384,9 @@
 
       spin_lock(&ds_lock);
 
+       error = -EPERM;
       if (!check_tracer(task))
-               return -EPERM;
+               goto out_unlock;
 
       error = -ENOMEM;
       context = ds_alloc_context(task);
#3 lore raw
Quoted 6 lines · stephane eranian

Markus,

I think this patch is not quite right. You don't want to go out via out_unlock because you're going to call ds_put_context)() when you did not invoke the matching ds_get_context() (hidden in ds_alloc_context). It happens later in the ds_request() function.

i noticed that, and fixed it via:

10db4ef: x86, PEBS/DS: fix code flow in ds_request()

can you still see problems with it?

Ingo

#4 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 6 lines · stephane eranian

Markus,

I think this patch is not quite right. You don't want to go out via out_unlock because you're going to call ds_put_context)() when you did not invoke the matching ds_get_context() (hidden in ds_alloc_context). It happens later in the ds_request() function.

Quoted 6 lines

i noticed that, and fixed it via:

10db4ef: x86, PEBS/DS: fix code flow in ds_request()

can you still see problems with it?

Well, I have lots of problems with ds.c so I have heavily modified the code therefore I have not pulled from
any public tree in several days.