Tejun Heo
de5634875b
block: fix double-free in the failure path of cgwb_bdi_init()
...
commit 5f478e4ea5 upstream.
When !CONFIG_CGROUP_WRITEBACK, bdi has single bdi_writeback_congested
at bdi->wb_congested. cgwb_bdi_init() allocates it with kzalloc() and
doesn't do further initialization. This usually works fine as the
reference count gets bumped to 1 by wb_init() and the put from
wb_exit() releases it.
However, when wb_init() fails, it puts the wb base ref automatically
freeing the wb and the explicit kfree() in cgwb_bdi_init() error path
ends up trying to free the same pointer the second time causing a
double-free.
Fix it by explicitly initilizing the refcnt to 1 and putting the base
ref from cgwb_bdi_destroy().
Signed-off-by: Tejun Heo <tj@kernel.org >
Reported-by: Dmitry Vyukov <dvyukov@google.com >
Fixes: a13f35e871 ("writeback: don't embed root bdi_writeback_congested in bdi_writeback")
Signed-off-by: Jens Axboe <axboe@fb.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2017-02-26 11:07:51 +01:00
..
2016-12-08 07:15:24 +01:00
2017-02-26 11:07:51 +01:00
2016-03-03 15:07:18 -08:00
2015-09-08 15:35:28 -07:00
2015-04-14 16:49:03 -07:00
2015-07-17 16:39:54 -07:00
2016-11-10 16:36:36 +01:00
2015-08-14 15:56:32 -07:00
2016-08-10 11:49:25 +02:00
2014-12-13 12:42:48 -08:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2015-06-02 08:33:35 -06:00
2015-11-06 17:50:42 -08:00
2017-02-09 08:02:46 +01:00
2015-11-05 19:34:48 -08:00
2015-06-24 17:49:45 -07:00
2016-10-20 10:00:47 +02:00
2014-08-06 18:01:22 -07:00
2016-05-04 14:48:49 -07:00
2015-11-06 17:50:42 -08:00
2017-01-19 20:17:19 +01:00
2015-09-10 13:29:01 -07:00
2017-01-06 11:16:11 +01:00
2016-08-10 11:49:25 +02:00
2015-02-10 14:30:31 -08:00
2015-11-06 17:50:42 -08:00
2015-01-08 15:10:52 -08:00
2014-10-09 22:25:50 -04:00
2014-06-06 16:08:18 -07:00
2015-11-05 19:34:48 -08:00
2016-10-07 15:23:40 +02:00
2016-11-10 16:36:32 +01:00
2015-11-05 19:34:48 -08:00
2015-09-08 15:35:28 -07:00
2015-09-11 16:42:39 -07:00
2015-11-05 19:34:48 -08:00
2017-02-01 08:30:54 +01:00
2017-02-09 08:02:47 +01:00
2016-02-25 12:01:21 -08:00
2016-05-04 14:48:49 -07:00
2017-02-01 08:30:52 +01:00
2015-11-06 17:50:42 -08:00
2015-09-08 15:35:28 -07:00
2016-07-27 09:47:31 -07:00
2015-11-05 19:34:48 -08:00
2016-02-25 12:01:21 -08:00
2015-06-30 19:44:56 -07:00
2016-02-25 12:01:21 -08:00
2014-02-21 08:50:17 +01:00
2015-09-10 13:29:01 -07:00
2015-02-11 17:06:02 -08:00
2015-09-04 16:54:41 -07:00
2015-11-05 19:34:48 -08:00
2015-11-05 19:34:48 -08:00
2015-06-30 19:44:55 -07:00
2015-11-05 19:34:48 -08:00
2015-12-12 10:15:34 -08:00
2017-01-15 13:41:36 +01:00
2015-11-05 19:34:48 -08:00
2015-09-10 13:29:01 -07:00
2015-09-10 13:29:01 -07:00
2015-08-13 12:32:00 -06:00
2016-04-20 15:41:53 +09:00
2015-07-17 16:39:54 -07:00
2016-07-27 09:47:29 -07:00
2015-03-25 16:20:30 -07:00
2014-09-02 14:46:05 -04:00
2014-09-02 14:46:02 -04:00
2016-07-27 09:47:33 -07:00
2016-02-25 12:01:23 -08:00
2016-02-25 12:01:16 -08:00
2015-11-06 17:50:42 -08:00
2015-11-05 19:34:48 -08:00
2016-07-27 09:47:40 -07:00
2016-08-16 09:30:51 +02:00
2015-11-22 11:58:44 -08:00
2015-11-22 11:58:44 -08:00
2015-11-22 11:58:44 -08:00
2016-05-04 14:48:49 -07:00
2014-01-21 16:19:47 -08:00
2014-04-07 16:35:54 -07:00
2014-12-10 17:41:09 -08:00
2015-09-08 15:35:28 -07:00
2015-11-06 17:50:42 -08:00
2016-11-18 10:48:34 +01:00
2015-06-02 08:33:33 -06:00
2015-09-04 16:54:41 -07:00
2016-09-15 08:27:46 +02:00
2015-11-05 19:34:48 -08:00
2015-11-20 16:17:32 -08:00
2014-12-02 17:32:07 -08:00
2017-01-06 11:16:14 +01:00
2016-01-08 23:47:54 -08:00
2016-10-28 03:01:34 -04:00
2015-11-06 17:50:42 -08:00
2015-11-06 17:50:42 -08:00
2016-05-18 17:06:44 -07:00
2017-02-09 08:02:45 +01:00