linux-stable/drivers/net/team
Florent Revest 6a1472d9be team: Fix use-after-free when an option instance allocation fails
commit c12296bbec upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-20 17:00:25 +01:00
..
Kconfig
Makefile
team.c team: Fix use-after-free when an option instance allocation fails 2023-12-20 17:00:25 +01:00
team_mode_activebackup.c
team_mode_broadcast.c
team_mode_loadbalance.c bpf: Refactor BPF_PROG_RUN into a function 2021-08-17 00:45:07 +02:00
team_mode_random.c
team_mode_roundrobin.c