Re: [RFC][PATCH v2 20/31] timers: usb: Use del_timer_shutdown() before freeing timer

From: Steven Rostedt
Date: Thu Oct 27 2022 - 17:21:58 EST


On Thu, 27 Oct 2022 16:42:27 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Thu, 27 Oct 2022 16:38:19 -0400
> Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > On Thu, Oct 27, 2022 at 11:05:45AM -0400, Steven Rostedt wrote:
> > > From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
> > >
> > > Before a timer is freed, del_timer_shutdown() must be called.
> >
> > Is this supposed to be true for all timers? Because the USB subsystem
> > contains an awful lot more timers than just the two you touched in this
> > patch.
>
> Yes, and this does mean that we are going to have to painstakingly find and
> fix ever one of them. This is why the last patch updates
> DEBUG_OBJECTS_TIMERS to detect cases where I miss.

BTW, as del_timer_shutdown() prevents the timer from being re-armed, there
are lots of timers in the kernel where I did not touch, because I could not
tell if the del_timer_sync() or the buggy del_timer() calls were for it to
be freed, or for some other legitimate reason, and I just stayed well enough
alone.

-- Steve