diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 17:49:17 +1100 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 17:50:16 +1100 |
commit | ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba (patch) | |
tree | acb71aa4ae7d1f1ed17bdd79033a6bad5e27186d /mm/slab.c | |
parent | 786a5e15b613a9cee4fc9139fc3113a5ab0fde79 (diff) | |
download | blackbird-op-linux-ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba.tar.gz blackbird-op-linux-ccd35fb9f4da856b105ea0f1e0cab3702e8ae6ba.zip |
kernel: kmem_ptr_validate considered harmful
This is a nasty and error prone API. It is no longer used, remove it.
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/mm/slab.c b/mm/slab.c index b1e40dafbab3..6107f2380e08 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2781,7 +2781,7 @@ static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp, /* * Map pages beginning at addr to the given cache and slab. This is required * for the slab allocator to be able to lookup the cache and slab of a - * virtual address for kfree, ksize, kmem_ptr_validate, and slab debugging. + * virtual address for kfree, ksize, and slab debugging. */ static void slab_map_pages(struct kmem_cache *cache, struct slab *slab, void *addr) @@ -3660,36 +3660,6 @@ void *kmem_cache_alloc_notrace(struct kmem_cache *cachep, gfp_t flags) EXPORT_SYMBOL(kmem_cache_alloc_notrace); #endif -/** - * kmem_ptr_validate - check if an untrusted pointer might be a slab entry. - * @cachep: the cache we're checking against - * @ptr: pointer to validate - * - * This verifies that the untrusted pointer looks sane; - * it is _not_ a guarantee that the pointer is actually - * part of the slab cache in question, but it at least - * validates that the pointer can be dereferenced and - * looks half-way sane. - * - * Currently only used for dentry validation. - */ -int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr) -{ - unsigned long size = cachep->buffer_size; - struct page *page; - - if (unlikely(!kern_ptr_validate(ptr, size))) - goto out; - page = virt_to_page(ptr); - if (unlikely(!PageSlab(page))) - goto out; - if (unlikely(page_get_cache(page) != cachep)) - goto out; - return 1; -out: - return 0; -} - #ifdef CONFIG_NUMA void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid) { |