]> git.baikalelectronics.ru Git - kernel.git/commit
slab_common: fix the check for duplicate slab names
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 4 Mar 2014 22:13:47 +0000 (17:13 -0500)
committerPekka Enberg <penberg@kernel.org>
Fri, 23 May 2014 21:25:46 +0000 (00:25 +0300)
commite54d62790b19f7e7ce494b5ff3386ee1c5c4d3e3
tree55e21a57416217cbacf8b5c16c0495a9317abc42
parent1f47e5110cb07c984f10c5d5fc78240a01d02fb1
slab_common: fix the check for duplicate slab names

The patch dd4c21b12c36524570d912fbf9984bb12097db14 is supposed to fix the
problem where kmem_cache_create incorrectly reports duplicate cache name
and fails. The problem is described in the header of that patch.

However, the patch doesn't really fix the problem because of these
reasons:

* the logic to test for debugging is reversed. It was intended to perform
  the check only if slub debugging is enabled (which implies that caches
  with the same parameters are not merged). Therefore, there should be
  #if !defined(CONFIG_SLUB) || defined(CONFIG_SLUB_DEBUG_ON)
  The current code has the condition reversed and performs the test if
  debugging is disabled.

* slub debugging may be enabled or disabled based on kernel command line,
  CONFIG_SLUB_DEBUG_ON is just the default settings. Therefore the test
  based on definition of CONFIG_SLUB_DEBUG_ON is unreliable.

This patch fixes the problem by removing the test
"!defined(CONFIG_SLUB_DEBUG_ON)". Therefore, duplicate names are never
checked if the SLUB allocator is used.

Note to stable kernel maintainers: when backporint this patch, please
backport also the patch dd4c21b12c36524570d912fbf9984bb12097db14.

Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org # 3.6+
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slab_common.c