OpenCloudOS-Kernel/drivers/misc/sgi-gru
Zheng Wang 643a16a0eb misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os
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>
2022-11-23 19:55:48 +01:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
gru.h
gru_instructions.h Add #includes needed to permit the removal of asm/system.h 2012-03-28 18:30:03 +01:00
grufault.c misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os 2022-11-23 19:55:48 +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-11-23 19:55:48 +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-11-23 19:55:48 +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