WSL2-Linux-Kernel/drivers/block/drbd
Xiaomeng Tong f799df4569 drbd: fix an invalid memory access caused by incorrect use of list iterator
[ Upstream commit ae4d37b5df ]

The bug is here:
	idr_remove(&connection->peer_devices, vnr);

If the previous for_each_connection() don't exit early (no goto hit
inside the loop), the iterator 'connection' after the loop will be a
bogus pointer to an invalid structure object containing the HEAD
(&resource->connections). As a result, the use of 'connection' above
will lead to a invalid memory access (including a possible invalid free
as idr_remove could call free_layer).

The original intention should have been to remove all peer_devices,
but the following lines have already done the work. So just remove
this line and the unneeded label, to fix this bug.

Cc: stable@vger.kernel.org
Fixes: c06ece6ba6 ("drbd: Turn connection->volumes into connection->peer_devices")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Reviewed-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Reviewed-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-07-12 16:35:00 +02:00
..
Kconfig Replace HTTP links with HTTPS ones: DRBD driver 2020-07-05 14:16:44 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_actlog.c drbd: remove bio_alloc_drbd 2021-01-27 09:51:48 -07:00
drbd_bitmap.c drbd: remove bio_alloc_drbd 2021-01-27 09:51:48 -07:00
drbd_debugfs.c block: drbd: no need to check return value of debugfs_create functions 2019-06-20 03:28:16 -06:00
drbd_debugfs.h block: drbd: no need to check return value of debugfs_create functions 2019-06-20 03:28:16 -06:00
drbd_int.h drbd: Fix five use after free bugs in get_initial_state 2022-04-13 20:59:19 +02:00
drbd_interval.c block: drbd: drbd_interval: Demote some kernel-doc abuses and fix another header 2021-04-06 09:21:53 -06:00
drbd_interval.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_main.c drbd: fix an invalid memory access caused by incorrect use of list iterator 2022-07-12 16:35:00 +02:00
drbd_nl.c drbd: Fix five use after free bugs in get_initial_state 2022-04-13 20:59:19 +02:00
drbd_nla.c netlink: make validation more configurable for future strictness 2019-04-27 17:07:21 -04:00
drbd_nla.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_proc.c drbd: remove a bogus bdi_rw_congested call 2020-07-08 17:05:53 -06:00
drbd_protocol.h drbd: Replace zero-length array with flexible-array 2020-06-15 23:08:31 -05:00
drbd_receiver.c drbd: remove unnecessary oom message 2021-06-09 09:41:49 -06:00
drbd_req.c drbd: fix potential silent data corruption 2022-04-08 14:22:57 +02:00
drbd_req.h drbd: remove drbd_req_make_private_bio 2021-01-27 09:51:48 -07:00
drbd_state.c drbd: Fix five use after free bugs in get_initial_state 2022-04-13 20:59:19 +02:00
drbd_state.h drbd: Change drbd_request_detach_interruptible's return type to int 2018-12-20 09:51:31 -07:00
drbd_state_change.h drbd: Fix five use after free bugs in get_initial_state 2022-04-13 20:59:19 +02:00
drbd_strings.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 91 2019-05-24 17:37:53 +02:00
drbd_strings.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
drbd_vli.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 91 2019-05-24 17:37:53 +02:00
drbd_worker.c drbd: remove drbd_req_make_private_bio 2021-01-27 09:51:48 -07:00