linux-stable/drivers/misc/sgi-gru
Zheng Wang 4e947fc71b 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:32:40 +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:32:40 +01:00
grufile.c
gruhandles.c
gruhandles.h
grukdump.c
grukservices.c misc: sgi-gru: grukservices: drop unexpected word "the" in the comments 2022-06-27 16:15:17 +02:00
grukservices.h
grulib.h
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:32:40 +01:00
gruprocfs.c
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:32:40 +01:00
grutlbpurge.c
Makefile