public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Zheng Wang <zyytlz.wz@163.com>
Cc: dimitri.sivanich@hpe.com, arnd@arndb.de,
	linux-kernel@vger.kernel.org, hackerzheng666@gmail.com,
	alex000young@gmail.com, security@kernel.org
Subject: Re: [PATCH] misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os
Date: Sat, 24 Sep 2022 14:54:28 +0200	[thread overview]
Message-ID: <Yy7+BCQnGaQiNlyF@kroah.com> (raw)
In-Reply-To: <20220919143205.207353-1-zyytlz.wz@163.com>

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 <hackerzheng666@gmail.com> Zhuorao Yang <alex000young@gmail.com>

Why twice?

Should be two different reported-by lines, right?

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

thanks,

greg k-h

  parent reply	other threads:[~2022-09-24 12:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 14:32 [PATCH] misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os Zheng Wang
2022-09-22  3:00 ` Zheng Hacker
2022-09-24 12:54 ` Greg KH [this message]
2022-09-26  2:41   ` Zheng Hacker
  -- strict thread matches above, loose matches on Subject: below --
2022-09-26  4:36 Zheng Wang
2022-09-26  8:36 ` Greg KH
2022-09-27 14:12   ` Zheng Hacker
2022-09-27 16:36     ` Greg KH
2022-09-28  3:03       ` Zheng Hacker
2022-10-02 11:25         ` Zheng Hacker
2022-10-02 14:14           ` Greg KH
2022-10-03  4:35             ` Zheng Hacker
2022-09-26  4:31 Zheng Wang
     [not found] <tencent_45DC133D0F8DBD599F40D6E228B9305B240A@qq.com>
2022-09-16 10:02 ` Greg KH
     [not found] <tencent_48738CD5589B4162E0D0B9D85B84DCD33C0A@qq.com>
2022-09-16  8:15 ` Greg KH
2022-09-16 15:18   ` Zheng Hacker
2022-09-16 15:20   ` Zheng Hacker
2022-09-16 15:33   ` Zheng Hacker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yy7+BCQnGaQiNlyF@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=alex000young@gmail.com \
    --cc=arnd@arndb.de \
    --cc=dimitri.sivanich@hpe.com \
    --cc=hackerzheng666@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=security@kernel.org \
    --cc=zyytlz.wz@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox