Andrey Konovalov 746f60f238 UPSTREAM: kasan: fix invalid-free test crashing the kernel
Upstream commit 91c93ed07f04f5b32a30321d522d8ca9504745bf.

When an invalid-free is triggered by one of the KASAN tests, the object
doesn't actually get freed.  This later leads to a BUG failure in
kmem_cache_destroy that checks that there are no allocated objects in
the cache that is being destroyed.

Fix this by calling kmem_cache_free with the proper object address after
the call that triggers invalid-free.

Link: http://lkml.kernel.org/r/286eaefc0a6c3fa9b83b87e7d6dc0fbb5b5c9926.1519924383.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Chris Mason <clm@fb.com>
Cc: Yury Norov <ynorov@caviumnetworks.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Luis R . Rodriguez" <mcgrof@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Jeff Layton <jlayton@redhat.com>
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>
Cc: Kostya Serebryany <kcc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: I73c3ae90a54a1fa840636dbf9f6ce3c9ea7f80c3
Bug: 128674696
2019-07-10 09:14:18 -07:00
..
2019-07-10 09:54:40 +02:00
2017-08-15 09:02:08 -07:00
2017-06-09 11:52:07 +02:00
2017-02-24 17:46:57 -08:00
2019-04-20 09:15:07 +02:00
2017-05-09 15:40:28 -07:00
2017-02-24 17:46:57 -08:00
2017-10-03 17:54:25 -07:00
2019-05-21 18:50:21 +02:00
2018-02-16 20:23:04 +01:00
2018-12-08 13:03:35 +01:00
2019-05-27 09:36:03 +02:00
2016-12-06 10:17:03 +02:00
2018-12-13 09:18:52 +01:00
2017-08-15 09:02:07 -07:00