linux-stable/drivers/misc/sgi-gru
Zheng Wang dbc1bb8c8e misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os
[ Upstream commit 643a16a0eb ]

In some bad situation, the gts may be freed gru_check_chiplet_assignment.
The call chain can be gru_unload_context->gru_free_gru_context->gts_drop
and kfree finally. However, the caller didn't know if the gts is freed
or not and use it afterwards. This will trigger a Use after Free bug.

Fix it by introducing a return value to see if it's in error path or not.
Free the gts in caller if gru_check_chiplet_assignment check failed.

Fixes: 55484c45db ("gru: allow users to specify gru chiplet 2")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Acked-by: Dimitri Sivanich <sivanich@hpe.com>
Link: https://lore.kernel.org/r/20221110035033.19498-1-zyytlz.wz@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:26:26 +01:00
..
gru.h
gru_instructions.h
grufault.c misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os 2022-12-31 13:26:26 +01:00
grufile.c x86/platform/uv: Update Copyrights to conform to HPE standards 2020-10-07 09:10:07 +02:00
gruhandles.c x86/cpu: Relocate sync_core() to sync_core.h 2020-07-27 12:42:06 +02:00
gruhandles.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
grukdump.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
grukservices.c misc: sgi-gru: grukservices: drop unexpected word "the" in the comments 2022-06-27 16:15:17 +02:00
grukservices.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
grulib.h misc: Replace zero-length array with flexible-array member 2020-03-18 12:24:19 +01:00
grumain.c misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os 2022-12-31 13:26:26 +01:00
gruprocfs.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
grutables.h misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os 2022-12-31 13:26:26 +01:00
grutlbpurge.c misc/sgi-gru: use mmu_notifier_get/put for struct gru_mm_struct 2019-08-16 12:02:59 -03:00
Makefile