Re: [PATCH v7] misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os

From: Greg KH
Date: Wed Nov 09 2022 - 05:08:37 EST


On Wed, Nov 09, 2022 at 05:33:47PM +0800, Zheng Wang wrote:
> Gts may be freed in gru_check_chiplet_assignment.
> The caller still use it after that, UAF happens.
>
> 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: 55484c45dbec ("gru: allow users to specify gru chiplet 2")
> Signed-off-by: Zheng Wang <zyytlz.wz@xxxxxxx>
> Acked-by: Dimitri Sivanich <sivanich@xxxxxxx>
> Tested-by: kernel test robot <lkp@xxxxxxxxx>

The kernel robot did not provide a tested-by comment for this as they
did not test it.

Please never add tags that the person does not submit to you.

greg k-h