Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1579775

[PATCH 4.9 18/60] mm/slub.c: fix random_seq offset destruction

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.9 18/60] mm/slub.c: fix random_seq offset destruction
Date 2017-02-13 14:30 +0100
Message-ID <taoRB-4fA-37@gated-at.bofh.it> (permalink)
References <taoyd-47y-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sean Rees <sean@erifax.org>

commit a810007afe239d59c1115fcaa06eb5b480f876e9 upstream.

Commit 210e7a43fa90 ("mm: SLUB freelist randomization") broke USB hub
initialisation as described in

  https://bugzilla.kernel.org/show_bug.cgi?id=177551.

Bail out early from init_cache_random_seq if s->random_seq is already
initialised.  This prevents destroying the previously computed
random_seq offsets later in the function.

If the offsets are destroyed, then shuffle_freelist will truncate
page->freelist to just the first object (orphaning the rest).

Fixes: 210e7a43fa90 ("mm: SLUB freelist randomization")
Link: http://lkml.kernel.org/r/20170207140707.20824-1-sean@erifax.org
Signed-off-by: Sean Rees <sean@erifax.org>
Reported-by: <userwithuid@gmail.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Thomas Garnier <thgarnie@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 mm/slub.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1419,6 +1419,10 @@ static int init_cache_random_seq(struct
 	int err;
 	unsigned long i, count = oo_objects(s->oo);
 
+	/* Bailout if already initialised */
+	if (s->random_seq)
+		return 0;
+
 	err = cache_random_seq_create(s, count, GFP_KERNEL);
 	if (err) {
 		pr_err("SLUB: Unable to initialize free list for %s\n",

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.9 00/60] 4.9.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 11/60] crypto: ccp - Fix double add when creating new DMA command Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 09/60] crypto: qat - zero esram only for DH85x devices Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 20/60] hns: avoid stack overflow with CONFIG_KASAN Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 05/60] dm rq: cope with DM device destruction while in dm_old_request_fn() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 21/60] ARM: 8643/3: arm/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 12/60] ARC: [arcompact] brown paper bag bug in unaligned access delay slot fixup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 18/60] mm/slub.c: fix random_seq offset destruction Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 28/60] target: Fix multi-session dynamic se_node_acl double free OOPs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 03/60] libnvdimm, namespace: do not delete namespace-id 0 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 24/60] drm/atomic: Fix double free in drm_atomic_state_default_clear Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 07/60] crypto: chcr - Check device is allocated before use Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 26/60] target: Use correct SCSI status during EXTENDED_COPY exception Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 02/60] acpi, nfit: fix acpi_nfit_flush_probe() crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 13/60] Input: uinput - fix crash when mixing old and new init style Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 19/60] ibmvscsis: Add SGL limit Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 25/60] target: Dont BUG_ON during NodeACL dynamic -> explicit conversion Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  Re: [PATCH 4.9 00/60] 4.9.10-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-02-13 18:10 +0100
    Re: [PATCH 4.9 00/60] 4.9.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 18:30 +0100
  Re: [PATCH 4.9 00/60] 4.9.10-stable review Guenter Roeck <linux@roeck-us.net> - 2017-02-13 21:10 +0100
    Re: [PATCH 4.9 00/60] 4.9.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-15 00:00 +0100

csiph-web