From: Hyunwoo Kim <imv4bel@gmail.com>
To: ChenXiaoSong <chenxiaosong2@huawei.com>
Cc: steve.glendinning@shawell.net, deller@gmx.de,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
"zhangxiaoxu (A)" <zhangxiaoxu5@huawei.com>,
yangerkun@huawei.com, imv4bel@gmail.com
Subject: Re: Question about patch "fbdev: smscufx: Fix use-after-free in ufx_ops_open()"
Date: Tue, 11 Oct 2022 08:34:36 -0700 [thread overview]
Message-ID: <20221011153436.GA4446@ubuntu> (raw)
In-Reply-To: <363cdfe4-f54d-0ce4-2f03-bcfe998deeef@huawei.com>
On Tue, Oct 11, 2022 at 10:13:02PM +0800, ChenXiaoSong wrote:
> 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 |
> ```
You are right. This v3 fix patch may prevent the UAF scenario I first suggested,
but not the one you suggested.
Any good ideas for this?
Could it be solved by adding a global flag variable indicating disconnected?
Regards,
Hyunwoo Kim.
next prev parent reply other threads:[~2022-10-11 15:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 14:13 Question about patch "fbdev: smscufx: Fix use-after-free in ufx_ops_open()" ChenXiaoSong
2022-10-11 15:34 ` Hyunwoo Kim [this message]
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=20221011153436.GA4446@ubuntu \
--to=imv4bel@gmail.com \
--cc=chenxiaosong2@huawei.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--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).