Xiyu Yang
4f7ade4152
btrfs: fix block group leak when removing fails
...
commit f6033c5e333238f299c3ae03fac8cc1365b23b77 upstream.
btrfs_remove_block_group() invokes btrfs_lookup_block_group(), which
returns a local reference of the block group that contains the given
bytenr to "block_group" with increased refcount.
When btrfs_remove_block_group() returns, "block_group" becomes invalid,
so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in several exception handling paths
of btrfs_remove_block_group(). When those error scenarios occur such as
btrfs_alloc_path() returns NULL, the function forgets to decrease its
refcnt increased by btrfs_lookup_block_group() and will cause a refcnt
leak.
Fix this issue by jumping to "out_put_group" label and calling
btrfs_put_block_group() when those error scenarios occur.
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 19:15:48 +02:00
..
2019-10-11 18:18:38 +02:00
2019-08-06 19:05:21 +02:00
2020-01-27 14:46:52 +01:00
2020-04-02 16:34:33 +02:00
2019-12-17 20:37:24 +01:00
2017-11-02 11:10:55 +01:00
2018-12-01 09:42:51 +01:00
2020-05-05 19:15:48 +02:00
2018-12-17 09:28:53 +01:00
2020-05-02 17:24:13 +02:00
2020-04-24 08:00:40 +02:00
2019-08-06 19:05:23 +02:00
2019-11-12 19:18:18 +01:00
2018-11-13 11:15:12 -08:00
2019-07-31 07:28:22 +02:00
2019-05-08 07:20:49 +02:00
2019-03-23 14:35:21 +01:00
2019-12-17 20:38:33 +01:00
2020-03-11 18:02:51 +01:00
2017-11-02 11:10:55 +01:00
2019-12-05 15:37:28 +01:00
2020-01-27 14:46:06 +01:00
2020-04-24 08:01:22 +02:00
2020-05-05 19:15:47 +02:00
2020-02-28 16:36:05 +01:00
2020-03-11 18:03:03 +01:00
2018-12-17 09:28:53 +01:00
2019-12-17 20:38:44 +01:00
2020-04-24 08:00:27 +02:00
2019-12-01 09:13:57 +01:00
2020-04-24 08:00:45 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-05-31 06:47:12 -07:00
2018-10-03 17:00:57 -07:00
2020-04-24 08:00:54 +02:00
2019-05-08 07:20:49 +02:00
2020-01-27 14:46:26 +01:00
2019-12-17 20:38:50 +01:00
2019-12-17 20:38:15 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:43 +02:00
2020-04-24 08:01:21 +02:00
2018-02-03 17:39:08 +01:00
2020-05-02 17:24:41 +02:00
2018-05-30 07:51:47 +02:00
2017-11-02 11:10:55 +01:00
2020-01-12 12:11:59 +01:00
2017-11-02 11:10:55 +01:00
2020-04-24 08:00:43 +02:00
2017-11-02 11:10:55 +01:00
2020-02-28 16:36:08 +01:00
2019-12-17 20:39:21 +01:00
2020-05-02 17:24:21 +02:00
2020-01-09 10:17:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-01-12 12:11:59 +01:00
2020-02-28 16:36:08 +01:00
2017-11-02 11:10:55 +01:00
2018-09-05 09:26:32 +02:00
2018-09-05 09:26:41 +02:00
2018-12-17 09:28:48 +01:00
2020-02-14 16:32:11 -05:00
2020-02-28 16:36:02 +01:00
2019-05-25 18:25:36 +02:00
2020-05-02 17:24:43 +02:00
2018-12-21 14:13:04 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-14 18:13:32 -07:00
2019-10-05 12:48:06 +02:00
2019-07-03 13:15:59 +02:00
2018-06-26 08:06:33 +08:00
2019-11-06 12:42:59 +01:00
2019-04-17 08:37:53 +02:00
2020-04-24 08:01:00 +02:00
2020-01-14 20:05:39 +01:00
2020-01-09 10:17:58 +01:00
2017-11-02 11:10:55 +01:00
2020-03-11 18:02:43 +01:00
2019-02-06 17:31:34 +01:00
2019-04-27 09:35:41 +02:00
2020-01-12 12:11:59 +01:00
2019-02-12 19:46:10 +01:00
2020-04-24 08:00:38 +02:00
2017-12-17 15:07:59 +01:00
2017-11-02 11:10:55 +01:00
2019-04-05 22:31:28 +02:00
2020-04-24 08:00:43 +02:00
2017-11-02 11:10:55 +01:00
2019-11-12 19:18:47 +01:00
2020-04-02 16:34:21 +02:00
2017-09-13 09:11:44 -07:00
2018-11-10 07:48:33 -08:00
2019-12-17 20:38:57 +01:00
2020-04-02 16:34:35 +02:00
2020-01-09 10:17:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-22 15:42:25 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-03-11 18:02:53 +01:00
2020-05-02 17:24:20 +02:00
2017-11-02 11:10:55 +01:00
2020-03-20 10:54:16 +01:00
2019-05-04 09:15:18 +02:00
2020-05-02 17:24:47 +02:00
2017-11-02 11:10:55 +01:00
2019-12-01 09:13:51 +01:00
2020-01-04 14:00:04 +01:00
2017-11-02 11:10:55 +01:00
2018-02-22 15:42:28 +01:00
2017-11-02 11:10:55 +01:00
2019-05-04 09:15:18 +02:00
2017-11-02 11:10:55 +01:00
2019-10-11 18:18:48 +02:00
2018-05-30 07:51:47 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2020-01-04 13:59:58 +01:00
2017-11-02 11:10:55 +01:00
2018-10-10 08:54:27 +02:00