lkml.org 
[lkml]   [2012]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [Patch] lkdtm: avoid calling lkdtm_do_action() with spin lock held
Date
On Tuesday 31 January 2012, Cong Wang wrote:
> @@ -323,14 +323,16 @@ static void lkdtm_do_action(enum ctype which)
> }
> case CT_WRITE_AFTER_FREE: {
> size_t len = 1024;
> - u32 *data = kmalloc(len, GFP_KERNEL);
> + u32 *data = kmalloc(len, GFP_ATOMIC);
>
> kfree(data);
> - schedule();
> + udelay(100);
> memset(data, 0x78, len);
> break;
> }

I can't think of why the udelay would have any positive effect here,
if the idea of the schedule was to let some other process allocate and
use the memory.

Can't you just get rid of the count_lock if you use an atomic_t for the
count and use appropriate accesses on it?

Arnd


\
 
 \ /
  Last update: 2012-01-31 16:39    [W:0.929 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site