summaryrefslogtreecommitdiffstats
path: root/lib/textsearch.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-12-11 00:41:25 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-11 02:41:02 +0100
commit2ce8e7ed006a6e86eecf59188da8652b8a3bc4f0 (patch)
tree86909497f906374db58b65f4af2219eb290d059d /lib/textsearch.c
parentdma-debug: introduce dma_debug_disabled (diff)
downloadlinux-2ce8e7ed006a6e86eecf59188da8652b8a3bc4f0.tar.xz
linux-2ce8e7ed006a6e86eecf59188da8652b8a3bc4f0.zip
dma-debug: prevent early callers from crashing
dma_debug_init() is called by architecture specific code at different levels, but typically as a fs_initcall due to the debugfs initialization. Some platforms may have early callers of the DMA-API, running prior to the fs_initcall() level, which is not much of an issue unless CONFIG_DMA_API_DEBUG is set. When the DMA-API debugging facilities are turned on a caller will go through: debug_dma_map_{single,page} -> dma_mapping_error (inline function usually) -> debug_dma_mapping_error -> get_hash_bucket Calling get_hash_bucket() returns a valid hash value since we hash on high bits of the dma_addr cookie, but we will grab an unitialized spinlock, which typically won't crash but produce a warning, the real crash will however happen during the bucket list traversal because the list has not been initialized yet. An obvious solution is of course to move some of the offenders to run after the fs_initcall level, but since this might not always be an option, we add a flag "dma_debug_initialized" which is set to false by default, and set to true once dma_debug_init() has had a chance to run. The dma_debug_disabled() helper function previously introduced just needs to check for dma_debug_initialized to allow the caller to proceed or not. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Horia Geanta <horia.geanta@freescale.com> Cc: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/textsearch.c')
0 files changed, 0 insertions, 0 deletions