Andrey Ryabinin
2b95fda2c4
X.509: Fix double free in x509_cert_parse() [ver #3 ]
...
We shouldn't free cert->pub->key in x509_cert_parse() because
x509_free_certificate() also does this:
BUG: Double free or freeing an invalid pointer
...
Call Trace:
[<ffffffff81896c20>] dump_stack+0x63/0x83
[<ffffffff81356571>] kasan_object_err+0x21/0x70
[<ffffffff81356ed9>] kasan_report_double_free+0x49/0x60
[<ffffffff813561ad>] kasan_slab_free+0x9d/0xc0
[<ffffffff81350b7a>] kfree+0x8a/0x1a0
[<ffffffff81844fbf>] public_key_free+0x1f/0x30
[<ffffffff818455d4>] x509_free_certificate+0x24/0x90
[<ffffffff818460bc>] x509_cert_parse+0x2bc/0x300
[<ffffffff81846cae>] x509_key_preparse+0x3e/0x330
[<ffffffff818444cf>] asymmetric_key_preparse+0x6f/0x100
[<ffffffff8178bec0>] key_create_or_update+0x260/0x5f0
[<ffffffff8178e6d9>] SyS_add_key+0x199/0x2a0
[<ffffffff821d823b>] entry_SYSCALL_64_fastpath+0x1e/0xad
Object at ffff880110bd1900, in cache kmalloc-512 size: 512
....
Freed:
PID = 2579
[<ffffffff8104283b>] save_stack_trace+0x1b/0x20
[<ffffffff813558f6>] save_stack+0x46/0xd0
[<ffffffff81356183>] kasan_slab_free+0x73/0xc0
[<ffffffff81350b7a>] kfree+0x8a/0x1a0
[<ffffffff818460a3>] x509_cert_parse+0x2a3/0x300
[<ffffffff81846cae>] x509_key_preparse+0x3e/0x330
[<ffffffff818444cf>] asymmetric_key_preparse+0x6f/0x100
[<ffffffff8178bec0>] key_create_or_update+0x260/0x5f0
[<ffffffff8178e6d9>] SyS_add_key+0x199/0x2a0
[<ffffffff821d823b>] entry_SYSCALL_64_fastpath+0x1e/0xad
Fixes: db6c43bd2132 ("crypto: KEYS: convert public key and digsig asym to the akcipher api")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
2016-11-25 12:57:48 +11:00
..
2016-11-25 12:57:48 +11:00
2016-10-05 06:18:09 +05:30
2015-06-25 23:29:24 +08:00
2015-05-11 15:06:43 +08:00
2016-06-23 18:29:53 +08:00
2016-07-18 17:35:46 +08:00
2016-07-18 17:35:43 +08:00
2015-01-13 22:29:11 +11:00
2016-01-18 18:16:33 +08:00
2016-07-01 23:45:03 +08:00
2015-12-09 20:03:57 +08:00
2016-07-01 23:45:11 +08:00
2015-08-17 16:53:41 +08:00
2016-04-05 20:35:41 +08:00
2016-11-22 15:02:24 +08:00
2015-04-22 09:30:21 +08:00
2016-02-06 15:23:55 +08:00
2015-04-22 09:30:18 +08:00
2014-11-24 22:43:57 +08:00
2015-10-20 21:59:25 +08:00
2014-11-24 22:43:57 +08:00
2016-07-18 17:35:38 +08:00
2016-07-18 17:35:39 +08:00
2016-09-13 18:44:57 +08:00
2011-09-22 21:25:25 +10:00
2015-01-13 22:29:11 +11:00
2015-01-13 22:29:11 +11:00
2015-01-13 22:29:11 +11:00
2015-01-13 22:29:11 +11:00
2013-08-14 20:42:03 +10:00
2014-11-26 20:06:30 +08:00
2016-07-18 17:35:40 +08:00
2016-07-03 00:57:23 -04:00
2016-07-18 17:35:41 +08:00
2010-02-16 20:31:37 +08:00
2014-11-26 20:06:30 +08:00
2010-02-16 20:31:04 +08:00
2016-01-30 22:11:22 +08:00
2016-01-19 15:52:10 +08:00
2013-09-12 15:31:34 +10:00
2016-09-13 20:27:26 +08:00
2016-09-07 21:04:36 +08:00
2016-10-11 15:06:33 -07:00
2016-07-18 17:35:44 +08:00
2016-07-21 12:26:55 +08:00
2014-03-21 21:54:28 +08:00
2016-07-18 17:35:39 +08:00
2016-07-18 17:35:44 +08:00
2014-11-24 22:43:57 +08:00
2015-01-13 22:29:11 +11:00
2016-06-23 18:29:56 +08:00
2016-07-01 23:45:18 +08:00
2016-08-24 21:04:49 +08:00
2014-11-26 20:06:30 +08:00
2016-06-23 18:29:57 +08:00
2016-06-24 21:24:59 +08:00
2016-06-24 21:24:59 +08:00
2016-06-23 18:29:57 +08:00
2016-06-24 21:24:59 +08:00
2016-09-13 18:44:57 +08:00
2014-11-24 22:43:57 +08:00
2015-04-23 14:18:09 +08:00
2016-10-02 22:31:52 +08:00
2011-07-08 17:21:21 +08:00
2016-10-02 22:26:40 +08:00
2015-12-20 15:27:12 +02:00
2014-11-26 20:06:30 +08:00
2016-01-25 22:42:12 +08:00
2016-06-24 21:24:58 +08:00
2015-06-25 23:18:33 +08:00
2016-08-09 18:25:09 +08:00
2016-02-01 22:27:05 +08:00
2014-11-24 22:43:57 +08:00
2016-06-23 18:29:56 +08:00
2014-11-26 20:06:30 +08:00
2014-11-24 22:43:57 +08:00
2014-11-24 22:43:57 +08:00
2016-04-15 22:36:36 +08:00
2016-07-18 17:35:46 +08:00
2016-09-13 20:27:26 +08:00
2014-11-24 22:43:57 +08:00
2015-12-22 20:43:35 +08:00
2013-12-09 20:09:12 +08:00
2014-11-24 22:43:57 +08:00
2014-11-26 20:06:30 +08:00
2015-08-17 16:53:53 +08:00
2015-07-17 21:20:26 +08:00
2015-04-23 14:18:09 +08:00
2008-07-10 20:35:12 +08:00
2014-11-24 22:43:57 +08:00
2014-11-24 22:43:57 +08:00
2014-11-24 22:43:57 +08:00
2014-11-24 22:43:57 +08:00
2015-06-22 15:49:18 +08:00
2016-08-24 21:07:10 +08:00
2016-09-22 17:42:08 +08:00
2016-07-01 23:45:18 +08:00
2016-07-05 23:05:26 +08:00
2015-10-14 22:23:16 +08:00
2015-01-13 22:29:11 +11:00
2016-11-22 15:02:25 +08:00
2014-11-24 22:43:57 +08:00
2016-07-18 17:35:46 +08:00
2015-01-13 22:29:11 +11:00
2015-12-22 20:43:35 +08:00
2016-08-08 23:43:46 +08:00
2015-12-22 20:43:35 +08:00
2015-04-10 21:39:41 +08:00
2016-03-17 11:22:54 -07:00
2016-07-18 17:35:46 +08:00
2016-07-01 23:45:24 +08:00
2015-07-17 21:20:20 +08:00
2015-01-13 22:29:11 +11:00
2016-10-02 22:33:43 +08:00
2016-08-31 23:21:25 +08:00
2015-01-13 22:29:11 +11:00
2011-11-09 11:53:32 +08:00
2015-01-13 22:29:11 +11:00
2014-11-26 20:06:30 +08:00
2015-01-13 22:29:11 +11:00
2014-11-26 20:06:30 +08:00
2016-08-31 23:00:48 +08:00
2016-08-16 17:16:49 +08:00