[lkml]   [2022]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os
On Mon, Sep 19, 2022 at 10:32:05PM +0800, Zheng Wang wrote:
> In grufile.c, gru_file_unlocked_ioctl function can be called by user.
> If the req is GRU_SET_CONTEXT_OPTION, it will call gru_set_context_option.
> In gru_set_context_option, as req can be controlled by user,
> We can reach gru_check_context_placement function call.
> In gru_check_context_placement function, if the error path was steped,
> say gru_check_chiplet_assignment return 0,
> Then it will fall into gru_unload_context function.
> And it will finnaly call kfree gts in gts_drop function.
> Then gru_unlock_gts will be called in gru_set_context_option function.
> This is a typical Use after free.
> The same problem exists in gru_handle_user_call_os and gru_fault.
> Fix it by introduce the return value to see if gts is in good case or not.
> Free the gts in caller when gru_check_chiplet_assignment check failed.

Your text formatting is a bit odd, don't you think?

> Reported-by: Zheng Wang <> Zhuorao Yang <>

Why twice?

Should be two different reported-by lines, right?

Otherwise looks good, can you fix that up and resend?


greg k-h

 \ /
  Last update: 2022-09-24 14:55    [W:0.073 / U:1.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site