Herbert Xu
687ca6afda
crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock()
...
commit 34c86f4c4a7be3b3e35aa48bd18299d4c756064d upstream.
The locking in af_alg_release_parent is broken as the BH socket
lock can only be taken if there is a code-path to handle the case
where the lock is owned by process-context. Instead of adding
such handling, we can fix this by changing the ref counts to
atomic_t.
This patch also modifies the main refcnt to include both normal
and nokey sockets. This way we don't have to fudge the nokey
ref count when a socket changes from nokey to normal.
Credits go to Mauricio Faria de Oliveira who diagnosed this bug
and sent a patch for it:
https://lore.kernel.org/linux-crypto/20200605161657.535043-1-mfo@canonical.com/
Reported-by: Brian Moyles <bmoyles@netflix.com>
Reported-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Fixes: 37f96694cf73 ("crypto: af_alg - Use bh_lock_sock in...")
Cc: <stable@vger.kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-09 09:36:30 +02:00
..
2019-07-31 07:28:31 +02:00
2017-11-02 11:10:55 +01:00
2015-06-25 23:29:24 +08:00
2016-10-25 11:08:33 +08:00
2016-06-23 18:29:53 +08:00
2018-10-03 17:00:45 -07:00
2017-04-21 20:30:50 +08:00
2017-01-13 00:24:39 +08:00
2017-02-11 17:50:43 +08:00
2019-02-12 19:45:57 +01:00
2020-07-09 09:36:30 +02:00
2019-03-23 14:35:18 +01:00
2017-01-13 00:24:39 +08:00
2020-02-14 16:32:14 -05:00
2020-06-25 15:42:01 +02:00
2020-07-09 09:36:30 +02:00
2020-07-09 09:36:30 +02:00
2015-04-22 09:30:21 +08:00
2020-07-09 09:36:30 +02:00
2015-04-22 09:30:18 +08:00
2014-11-24 22:43:57 +08:00
2020-02-14 16:32:14 -05:00
2014-11-24 22:43:57 +08:00
2019-01-23 08:09:48 +01:00
2019-01-23 08:09:47 +01:00
2018-10-03 17:00:45 -07: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
2017-03-09 18:34:39 +08:00
2019-05-21 18:50:20 +02:00
2017-08-22 14:45:47 +08:00
2019-07-31 07:28:35 +02:00
2016-10-21 11:03:42 +08:00
2017-02-11 17:52:28 +08:00
2016-10-21 11:03:42 +08:00
2018-02-16 20:23:00 +01:00
2018-02-16 20:23:00 +01:00
2013-09-12 15:31:34 +10:00
2019-05-21 18:50:15 +02:00
2019-07-10 09:54:38 +02:00
2017-06-19 14:19:54 +08:00
2016-07-18 17:35:44 +08:00
2019-12-17 20:38:55 +01:00
2014-03-21 21:54:28 +08:00
2017-08-04 09:27:15 +08:00
2017-02-11 17:52:28 +08:00
2017-04-24 18:11:08 +08:00
2015-01-13 22:29:11 +11:00
2017-11-21 09:49:21 +01:00
2017-11-21 09:49:20 +01:00
2018-05-01 12:58:23 -07:00
2014-11-26 20:06:30 +08:00
2017-11-02 11:10:55 +01:00
2019-12-17 20:38:55 +01:00
2017-06-10 12:04:35 +08:00
2017-06-10 12:04:25 +08:00
2017-08-03 13:47:22 +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
2019-05-21 18:50:15 +02:00
2017-04-05 21:58:35 +08:00
2019-07-31 07:28:35 +02:00
2015-12-20 15:27:12 +02:00
2017-12-20 10:10:17 +01:00
2020-02-14 16:32:14 -05:00
2016-11-17 23:34:52 +08:00
2015-06-25 23:18:33 +08:00
2019-02-12 19:45:57 +01:00
2016-02-01 22:27:05 +08:00
2014-11-24 22:43:57 +08:00
2017-01-13 00:24:39 +08:00
2020-05-20 08:17:11 +02:00
2017-04-10 19:17:27 +08:00
2017-04-10 19:17:27 +08:00
2017-05-08 17:15:13 -07:00
2018-09-19 22:43:37 +02:00
2018-02-16 20:23:00 +01:00
2014-11-24 22:43:57 +08:00
2017-03-24 22:02:56 +08:00
2013-12-09 20:09:12 +08:00
2014-11-24 22:43:57 +08:00
2019-03-23 14:35:21 +01:00
2020-02-14 16:32:14 -05:00
2018-02-16 20:23:00 +01:00
2015-04-23 14:18:09 +08:00
2017-11-02 11:10:55 +01: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
2017-07-28 17:56:00 +08:00
2017-12-20 10:10:17 +01:00
2019-11-20 18:00:47 +01:00
2017-06-10 12:04:30 +08:00
2016-07-05 23:05:26 +08:00
2015-10-14 22:23:16 +08:00
2019-05-21 18:50:19 +02:00
2016-11-22 15:02:25 +08:00
2017-08-03 13:52:44 +08:00
2014-11-24 22:43:57 +08:00
2017-02-11 17:52:28 +08:00
2019-07-31 07:28:30 +02:00
2015-12-22 20:43:35 +08:00
2018-02-03 17:38:51 +01:00
2015-12-22 20:43:35 +08:00
2015-04-10 21:39:41 +08:00
2019-03-23 14:35:18 +01:00
2018-12-01 09:42:53 +01:00
2019-10-11 18:18:32 +02:00
2018-11-13 11:15:07 -08:00
2015-07-17 21:20:20 +08:00
2015-01-13 22:29:11 +11:00
2019-03-23 14:35:18 +01:00
2019-04-27 09:35:37 +02:00
2020-01-27 14:46:13 +01:00
2011-11-09 11:53:32 +08:00
2015-01-13 22:29:11 +11:00
2018-08-17 21:01:10 +02:00
2015-01-13 22:29:11 +11:00
2014-11-26 20:06:30 +08:00
2018-02-22 15:42:23 +01:00
2020-05-20 08:17:11 +02:00