Re: [PATCH v6 RESEND] 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 - 04:36:04 EST


On Wed, Nov 09, 2022 at 05:24:05PM +0800, Zheng Hacker wrote:
> Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> 于2022年11月9日周三 16:46写道:
> >
> > On Wed, Nov 09, 2022 at 04:41:42PM +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")
> > > Reported-by: Zheng Wang <hackerzheng666@xxxxxxxxx>
> > > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > >
> >
> > Why the blank line?
>
> > Sorry for the spelling problem, fixed it next version
>
> > And the kernel test robot didn't find this issue, right?
> >
>
> Yes, it helped with the test and found an unused variable. I added
> this line as the mail suggested
> ("If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>").
>
> Should I remove it?

If you submit a patch that just fixes the issue that the test robot
finds, yes, that needs to be there. If you are fixing up a patch that
you submit based on the report, no, you do not.

thanks,

greg k-h