linux/drivers/net/team
Florent Revest c12296bbec team: Fix use-after-free when an option instance allocation fails
In __team_options_register, team_options are allocated and appended to
the team's option_list.
If one option instance allocation fails, the "inst_rollback" cleanup
path frees the previously allocated options but doesn't remove them from
the team's option_list.
This leaves dangling pointers that can be dereferenced later by other
parts of the team driver that iterate over options.

This patch fixes the cleanup path to remove the dangling pointers from
the list.

As far as I can tell, this uaf doesn't have much security implications
since it would be fairly hard to exploit (an attacker would need to make
the allocation of that specific small object fail) but it's still nice
to fix.

Cc: stable@vger.kernel.org
Fixes: 80f7c6683f ("team: add support for per-port options")
Signed-off-by: Florent Revest <revest@chromium.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://lore.kernel.org/r/20231206123719.1963153-1-revest@chromium.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-12-08 10:45:49 -08:00
..
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
team_mode_activebackup.c team: change the getter function in the team_option structure to void 2023-08-08 15:04:05 -07:00
team_mode_broadcast.c team: remove unreferenced header in broadcast and roundrobin files 2023-08-08 15:04:04 -07:00
team_mode_loadbalance.c team: remove unused input parameters in lb_htpm_select_tx_port and lb_hash_select_tx_port 2023-08-08 15:04:05 -07:00
team_mode_random.c treewide: use get_random_u32_below() instead of deprecated function 2022-11-18 02:15:15 +01:00
team_mode_roundrobin.c team: remove unreferenced header in broadcast and roundrobin files 2023-08-08 15:04:04 -07:00
team.c team: Fix use-after-free when an option instance allocation fails 2023-12-08 10:45:49 -08:00