bug on kmem_cache_free with the wrong cache
Signed-off-by: Daniel Micay <danielmicay@gmail.com> Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
This commit is contained in:
parent
0fc6163cd6
commit
8df273c856
1 changed files with 4 additions and 0 deletions
|
@ -510,10 +510,14 @@ static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
|
|||
return s;
|
||||
|
||||
cachep = virt_to_cache(x);
|
||||
#ifdef CONFIG_BUG_ON_DATA_CORRUPTION
|
||||
BUG_ON(cachep && cachep != s);
|
||||
#else
|
||||
if (WARN(cachep && cachep != s,
|
||||
"%s: Wrong slab cache. %s but object is from %s\n",
|
||||
__func__, s->name, cachep->name))
|
||||
print_tracking(cachep, x);
|
||||
#endif
|
||||
return cachep;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue