linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong2@huawei.com>
To: Hyunwoo Kim <imv4bel@gmail.com>
Cc: <steve.glendinning@shawell.net>, <deller@gmx.de>,
	<linux-fbdev@vger.kernel.org>, <dri-devel@lists.freedesktop.org>,
	<imv4bel@gmail.com>, "zhangxiaoxu (A)" <zhangxiaoxu5@huawei.com>,
	<yangerkun@huawei.com>
Subject: Question about patch "fbdev: smscufx: Fix use-after-free in ufx_ops_open()"
Date: Tue, 11 Oct 2022 22:13:02 +0800	[thread overview]
Message-ID: <363cdfe4-f54d-0ce4-2f03-bcfe998deeef@huawei.com> (raw)

Hi Hyunwoo:

[patch "fbdev: smscufx: Fix use-after-free in 
ufx_ops_open()"](https://lore.kernel.org/all/20220925133243.GA383897@ubuntu/T/) 
fix [CVE-2022-41849](https://nvd.nist.gov/vuln/detail/CVE-2022-41849).

If the UAF scenarios is as follows, it seems that [fix path 
v3](https://lore.kernel.org/all/20220925133243.GA383897@ubuntu/T/) will 
not avoid race contidion of krefs:

```
           cpu0                       |        cpu1
-------------------------------------|---------------------------------------------------
  1. open()                           |
     ufx_ops_open()                   |
-------------------------------------|---------------------------------------------------
                                      | 2. ufx_usb_disconnect()
                                      |    dev->virtualized = true;
                                      |    atomic_set()
                                      |    usb_set_intfdata()
                                      |
                                      | 3. if (dev->fb_count == 0)
                                      |    schedule_delayed_work()
                                      |    kref_put()   <- kref count : 1
                                      |    kref_put()   <- kref count : 0
                                      |    ufx_free()
                                      |    kfree(dev);
-------------------------------------|---------------------------------------------------
  4. if (dev->virtualized) <==== UAF  |
```

Did I misunderstand the UAF scenarios ?

             reply	other threads:[~2022-10-11 14:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 14:13 ChenXiaoSong [this message]
2022-10-11 15:34 ` Question about patch "fbdev: smscufx: Fix use-after-free in ufx_ops_open()" Hyunwoo Kim
2022-10-20 20:05 ` Hyunwoo Kim

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=363cdfe4-f54d-0ce4-2f03-bcfe998deeef@huawei.com \
    --to=chenxiaosong2@huawei.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imv4bel@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=steve.glendinning@shawell.net \
    --cc=yangerkun@huawei.com \
    --cc=zhangxiaoxu5@huawei.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;
as well as URLs for NNTP newsgroup(s).