On Fri, Jun 11, 2021 at 04:23:58PM +0300, Felipe Balbi wrote: > Peter Chen <peter.chen@xxxxxxxxxx> writes: > > > On 21-06-10 08:36:57, Greg Kroah-Hartman wrote: > >> On Thu, Jun 10, 2021 at 10:00:47AM +0800, Peter Chen wrote: > >> > On 21-06-09 11:42:53, Greg Kroah-Hartman wrote: > >> > > On Wed, Jun 09, 2021 at 11:01:07AM +0200, Greg Kroah-Hartman wrote: > >> > > > On Tue, Jun 08, 2021 at 09:50:01AM -0700, Jack Pham wrote: > >> > > > > Hi Peter, > >> > > > > > >> > > > > On Tue, Jun 08, 2021 at 06:56:56PM +0800, Peter Chen wrote: > >> > > > > > When do system reboot, it calls dwc3_shutdown and the whole debugfs > >> > > > > > for dwc3 has removed first, when the gadget tries to do deinit, and > >> > > > > > remove debugfs for its endpoints, it meets NULL pointer dereference > >> > > > > > issue when call debugfs_lookup. Fix it by removing the whole dwc3 > >> > > > > > debugfs later than dwc3_drd_exit. > >> > > > > > >> > > > > Ouch, thanks for catching this! I think in your previous reply[1] you > >> > > > > did warn about the debugfs_remove_recursive() getting called twice, but > >> > > > > it seems here the issue is due to the debugfs_lookup() getting called on > >> > > > > a stale dwc->root pointer after it was already removed. > >> > > > > >> > > > We can also fix this by getting rid of that "root" pointer as it's > >> > > > useless (we can look it up if we need it.) I'll send a patch later to > >> > > > do that, as it's a good idea to do anyway, and is independant of this > >> > > > fix. > >> > > > >> > > Now sent: > >> > > https://lore.kernel.org/r/20210609093924.3293230-1-gregkh@xxxxxxxxxxxxxxxxxxx > >> > > >> > Hi Felipe, > >> > > >> > With Greg above patch, this issue is fixed indirectly. I don't think my patch is > >> > needed, do you think so? > >> > >> Which patch is "your patch" here? > >> > > > > The patch in this thread. > > This one, Greg: > https://lore.kernel.org/r/20210609093924.3293230-1-gregkh@xxxxxxxxxxxxxxxxxxx > > Now that we have that, I don't think $subject is required. I don't think it's needed to revert, it's all "safer" this way... thanks, greg k-h