From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Yibo Tan <lhfff@tju.edu.cn>
Cc: "Andy Shevchenko" <andy@kernel.org>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Jean-François Lessard" <jefflessard3@gmail.com>,
"Surendra Singh Chouhan" <kr494167@gmail.com>,
"Chris Packham" <chris.packham@alliedtelesis.co.nz>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v1] auxdisplay: linedisp: prepare message before registration
Date: Tue, 13 Oct 2026 13:06:53 +0300 [thread overview]
Message-ID: <as4Cvc3PS4sLEjlL@ashevche-desk.local> (raw)
In-Reply-To: <20260912161152.1683002-1-lhfff@tju.edu.cn>
On Sun, Sep 13, 2026 at 12:11:52AM +0800, Yibo Tan wrote:
> Since the line-display attachment support was added, linedisp_register()
> has displayed its initial message before calling device_add(). The
> HT16K33, MAX6959 and GPIO segment drivers implement display updates with
> delayed work, so that display operation can publish driver-owned work
> before the final fallible registration step.
>
> If device_add() fails, the registration error path releases the display
> buffers and the caller's probe failure releases its managed private data.
> The admitted worker can then access both freed objects. In an HT16K33
> KASAN reproducer, a real device_add() -EEXIST failure produced a
> slab-use-after-free first in __pwq_activate_work() and then in
> ht16k33_seg7_update().
>
> The vulnerable kernel queued and executed the freed HT16K33 work in three
> of three runs. With this change, the same three runs reached the same
> device_add() failure without queuing the update and produced no KASAN,
> WARNING, Oops or panic.
>
> Separate message preparation from the hardware update. Prepare the
> initial message before registering the device or attribute groups, and
> only invoke the non-failing update after registration succeeds. Apply the
> same ordering to linedisp_attach(), which has the same static pattern but
> currently has no in-tree caller.
Yeah, but this will fix only work queueing and not the whole issue as was
earlier noted (about allocation of the private data in the driver and using
it inside the auxdisplay core. Can we rather redo the _register() / _unregister()
APIs to follow the design that is used, for instance, in IIO subsystem?
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-10-13 10:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 16:11 Yibo Tan
2026-10-13 10:06 ` Andy Shevchenko [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=as4Cvc3PS4sLEjlL@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=geert@linux-m68k.org \
--cc=jefflessard3@gmail.com \
--cc=kr494167@gmail.com \
--cc=lhfff@tju.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®