Tejun Heo
1cb3de83ab
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:10:52 +01:00
..
2016-11-30 16:32:52 -08:00
2017-02-26 11:10:52 +01:00
2016-07-26 16:19:19 -07:00
2016-10-11 15:06:33 -07:00
2016-01-27 09:09:57 -05:00
2015-07-17 16:39:54 -07:00
2016-11-11 08:12:37 -08:00
2015-08-14 15:56:32 -07:00
2017-01-12 11:39:32 +01:00
2016-03-17 15:09:34 -07:00
2016-10-07 18:46:29 -07:00
2016-03-17 15:09:34 -07:00
2015-11-05 19:34:48 -08:00
2016-06-09 14:23:11 -07:00
2016-03-15 16:55:16 -07:00
2017-02-09 08:08:28 +01:00
2016-10-19 08:11:24 -07:00
2016-07-26 16:19:19 -07:00
2016-10-24 19:13:20 -07:00
2016-05-19 19:12:14 -07:00
2017-02-01 08:33:04 +01:00
2016-05-20 17:58:30 -07:00
2017-01-19 20:17:59 +01:00
2015-09-10 13:29:01 -07:00
2017-01-06 10:40:13 +01:00
2016-10-07 18:46:29 -07:00
2015-02-10 14:30:31 -08:00
2016-10-27 16:23:01 -07:00
2016-09-13 02:35:27 +02:00
2017-01-12 11:39:32 +01:00
2016-03-17 15:09:34 -07:00
2016-03-17 15:09:34 -07:00
2016-11-11 08:12:37 -08:00
2016-10-07 18:46:29 -07:00
2016-10-27 18:43:42 -07:00
2016-05-22 17:21:27 -07:00
2016-05-23 17:04:14 -07:00
2016-10-12 10:23:41 -07:00
2016-10-11 15:06:33 -07:00
2017-02-01 08:33:14 +01:00
2017-02-09 08:08:28 +01:00
2016-11-11 08:12:37 -08:00
2017-01-06 10:40:13 +01:00
2017-02-01 08:33:04 +01:00
2016-07-28 16:07:41 -07:00
2015-09-08 15:35:28 -07:00
2017-01-12 11:39:32 +01:00
2016-10-07 18:46:28 -07:00
2016-11-30 16:32:52 -08:00
2016-03-17 15:09:34 -07:00
2016-10-07 18:46:29 -07:00
2016-04-28 11:44:19 +02:00
2016-03-17 15:09:34 -07:00
2016-05-19 19:12:14 -07:00
2016-10-19 17:28:48 +02:00
2016-11-29 08:20:24 -08:00
2015-11-05 19:34:48 -08:00
2016-10-11 15:06:33 -07:00
2017-01-06 10:40:13 +01:00
2016-10-07 18:46:29 -07:00
2017-02-01 08:33:05 +01:00
2015-11-05 19:34:48 -08:00
2016-10-07 18:46:27 -07:00
2016-07-28 16:07:41 -07:00
2016-10-07 18:46:29 -07:00
2016-10-07 18:46:29 -07:00
2016-10-07 18:46:27 -07:00
2016-06-03 15:06:22 -07:00
2016-10-07 18:46:28 -07:00
2016-01-15 17:56:32 -08:00
2016-03-17 15:09:34 -07:00
2014-09-02 14:46:02 -04:00
2016-10-05 11:52:55 -04:00
2016-03-17 15:09:34 -07:00
2016-10-18 14:13:37 -07:00
2016-03-17 15:09:34 -07:00
2016-08-26 17:39:35 -07:00
2016-08-10 16:40:56 -07:00
2016-12-06 08:59:05 -08:00
2016-11-11 08:12:37 -08:00
2017-01-19 20:17:59 +01:00
2016-10-27 18:43:43 -07:00
2016-02-18 16:23:24 -08:00
2017-02-14 15:25:35 -08:00
2016-08-02 17:31:41 -04:00
2016-08-02 17:31:41 -04:00
2016-03-17 15:09:34 -07:00
2016-10-07 18:46:28 -07:00
2016-10-07 18:46:28 -07:00
2017-01-19 20:17:59 +01:00
2016-11-30 16:32:52 -08:00
2016-09-20 16:07:39 -07:00
2016-04-04 10:41:08 -07:00
2016-10-22 09:39:10 -07:00
2016-10-07 18:46:27 -07:00
2016-10-07 18:46:29 -07:00
2016-02-03 08:28:43 -08:00
2017-01-19 20:17:59 +01:00
2016-10-07 18:46:30 -07:00
2016-12-02 18:48:03 -08:00
2016-06-03 16:02:55 -07:00
2016-01-15 11:40:52 -08:00
2015-11-06 17:50:42 -08:00
2016-07-28 16:07:41 -07:00
2017-02-09 08:08:27 +01:00