Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28918
b: refs/heads/master
c: 58ce1fd
h: refs/heads/master
v: v3
  • Loading branch information
Pekka Enberg authored and Linus Torvalds committed Jun 23, 2006
1 parent 512f72a commit 4c16b56
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 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: b344e05c585406904c70865e531e02467c4c7931
refs/heads/master: 58ce1fd5805647a58a050bbbbd2252ea5ecb47b3
32 changes: 23 additions & 9 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -2636,6 +2636,28 @@ static void kfree_debugcheck(const void *objp)
}
}

static inline void verify_redzone_free(struct kmem_cache *cache, void *obj)
{
unsigned long redzone1, redzone2;

redzone1 = *dbg_redzone1(cache, obj);
redzone2 = *dbg_redzone2(cache, obj);

/*
* Redzone is ok.
*/
if (redzone1 == RED_ACTIVE && redzone2 == RED_ACTIVE)
return;

if (redzone1 == RED_INACTIVE && redzone2 == RED_INACTIVE)
slab_error(cache, "double free detected");
else
slab_error(cache, "memory outside object was overwritten");

printk(KERN_ERR "%p: redzone 1:0x%lx, redzone 2:0x%lx.\n",
obj, redzone1, redzone2);
}

static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
void *caller)
{
Expand All @@ -2659,15 +2681,7 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
slabp = page_get_slab(page);

if (cachep->flags & SLAB_RED_ZONE) {
if (*dbg_redzone1(cachep, objp) != RED_ACTIVE ||
*dbg_redzone2(cachep, objp) != RED_ACTIVE) {
slab_error(cachep, "double free, or memory outside"
" object was overwritten");
printk(KERN_ERR "%p: redzone 1:0x%lx, "
"redzone 2:0x%lx.\n",
objp, *dbg_redzone1(cachep, objp),
*dbg_redzone2(cachep, objp));
}
verify_redzone_free(cachep, objp);
*dbg_redzone1(cachep, objp) = RED_INACTIVE;
*dbg_redzone2(cachep, objp) = RED_INACTIVE;
}
Expand Down

0 comments on commit 4c16b56

Please sign in to comment.