From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Surendra Singh <kr494167@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
andy@kernel.org, geert@linux-m68k.org,
chris.packham@alliedtelesis.co.nz, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] auxdisplay: seg-led-gpio: fix work initialization race and convert to devm_add_action_or_reset()
Date: Mon, 17 Aug 2026 18:44:04 +0300 [thread overview]
Message-ID: <aoMsRLhXWKej10Q3@ashevche-desk.local> (raw)
In-Reply-To: <CANA_=K3kSPqzuF-GOVuqnViY9Q0mMS74ik60ni1eauKGx223uQ@mail.gmail.com>
On Sun, Aug 02, 2026 at 04:30:16PM +0530, Surendra Singh wrote:
> I checked the other drivers in drivers/auxdisplay/ and found that
> drivers/auxdisplay/max6959.c has the exact same pattern:
>
> 1. INIT_DELAYED_WORK(&priv->work, max6959_disp_update) is called inside
> max6959_linedisp_get_map_type() (map query callback).
> 2. max6959_i2c_remove() calls cancel_delayed_work_sync(&priv->work)
> before linedisp_unregister(&priv->linedisp).
>
> I can prepare a 2-patch series fixing max6959.c as well.
Yes, please do. Or did I miss them?
> Furthermore, we could add devm_linedisp_register() to line-display.c
> to simplify linedisp teardown across all auxdisplay drivers.
That's what we all are waiting for to avoid some UAF types of bugs.
> On Sun, 2 Aug 2026 at 14:59, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > On Fri, Jul 24, 2026 at 5:55 AM <kr494167@gmail.com> wrote:
> > > INIT_DELAYED_WORK(&priv->work, seg_led_update) was previously called inside
> > > seg_led_linedisp_get_map_type(), which is invoked during/after
> > > linedisp_register(). Initializing a delayed_work structure inside a map
> > > query callback can re-initialize an active work item or race with
> > > seg_led_linedisp_update().
> > >
> > > In addition, seg_led_remove() called cancel_delayed_work_sync(&priv->work)
> > > before linedisp_unregister(&priv->linedisp), allowing sysfs updates to
> > > reschedule work after cancel_delayed_work_sync() completed.
> > >
> > > Fix these by moving INIT_DELAYED_WORK() to probe() and using
> > > devm_add_action_or_reset() for devm-managed cleanup. Registering
> > > seg_led_unregister_linedisp after seg_led_cancel_work ensures proper LIFO
> > > teardown order (sysfs interface unregistered first, followed by work
> > > cancellation), allowing seg_led_remove() to be removed entirely.
> >
> > I think we have more drivers than this one with the same issue, no? If
> > so, can we solve this once for all (the existing and possible future
> > ones)?
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-08-17 15:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 2:55 kr494167
2026-07-24 3:26 ` Chris Packham
2026-08-02 9:28 ` Andy Shevchenko
2026-08-02 11:00 ` Surendra Singh
2026-08-17 15:44 ` 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=aoMsRLhXWKej10Q3@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=chris.packham@alliedtelesis.co.nz \
--cc=geert@linux-m68k.org \
--cc=kr494167@gmail.com \
--cc=linux-kernel@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®