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