From: Helge Deller <deller@gmx.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>, Tuo Li <islituo@gmail.com>
Cc: simona@ffwll.ch, tzimmermann@suse.de, kees@kernel.org,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] fbdev:modedb: fix a possible UAF in fb_find_mode()
Date: Thu, 11 Jun 2026 12:52:29 +0200 [thread overview]
Message-ID: <e0047f95-987c-4be8-9e49-496dd4a317b8@gmx.de> (raw)
In-Reply-To: <CAMuHMdW_+WE2uUyqAEhSqT7F4pWseO6Gygbw3tCo7LpAJB2C4Q@mail.gmail.com>
On 6/11/26 10:10, Geert Uytterhoeven wrote:
> Hi Tuo, Helge,
>
> On Wed, 10 Jun 2026 at 04:50, Tuo Li <islituo@gmail.com> wrote:
>> If mode_option is NULL, it is assigned from mode_option_buf:
>>
>> if (!mode_option) {
>> fb_get_options(NULL, &mode_option_buf);
>> mode_option = mode_option_buf;
>> }
>>
>> Later, name is assigned from mode_option:
>>
>> const char *name = mode_option;
>>
>> However, mode_option_buf is freed before name is no longer used:
>>
>> kfree(mode_option_buf);
>>
>> while name is still accessed by:
>>
>> if ((name_matches(db[i], name, namelen) ||
>>
>> Since name aliases mode_option_buf, this may result in a
>> use-after-free.
>>
>> Fix this by extending the lifetime of mode_option_buf until the end of the
>> function and using scope-based resource management for cleanup.
>>
>> Signed-off-by: Tuo Li <islituo@gmail.com>
>> ---
>> v2:
>> * Use scope-based resource management instead of manual kfree() calls.
>> Thanks to Helge Deller for the helpful advice.
>
> Thanks for your patch, which is now commit 85b6256469cebdac ("fbdev:
> modedb: fix a possible UAF in fb_find_mode()") in fbdev/for-next, and has:
>
> Cc: stable@vger.kernel.org # v6.5+
>
> I believe it needs:
> Fixes: 089d924d03d5c17b ("fbdev: Read video= option with
> fb_get_option() in modedb")
>
> and that commit entered v6.4-rc1, i.e. not v6.5?
Right, but I added the v6.5+ tag, because this patch uses the "__cleanup() based infrastructure",
which I think was introduced with v6.5.
Helge
prev parent reply other threads:[~2026-06-11 10:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 2:50 [PATCH v2] fbdev:modedb: fix a possible UAF in fb_find_mode() Tuo Li
2026-06-11 8:10 ` Geert Uytterhoeven
2026-06-11 10:52 ` Helge Deller [this message]
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=e0047f95-987c-4be8-9e49-496dd4a317b8@gmx.de \
--to=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=islituo@gmail.com \
--cc=kees@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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