Re: [PATCH 1/2] PCI: dwc: Guard RAS DES debugfs deinit
Shuvam Pandey <[email protected]>
| Newsgroups | org.infradead.lists.linux-amlogic,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <CANAAWHKBFmgQfqUNaiUrPxBk4bPoBpRbhJs9YqszKvBUbUrMXg@mail.gmail.com> |
Hi Bjorn, > I guess this prevents a NULL pointer dereference, right? Yes. This is in the CONFIG_PCIE_DW_DEBUGFS teardown path when the controller does not advertise the RAS DES capability. In that case dwc_pcie_rasdes_debugfs_init() returns 0 before allocating pci->debugfs->rasdes_info or initializing reg_event_lock. Later, dwc_pcie_debugfs_deinit() still calls dwc_pcie_rasdes_debugfs_deinit() unconditionally. With CONFIG_DEBUG_MUTEXES, mutex_destroy() dereferences the mutex, so calling it via &rinfo->reg_event_lock when rinfo is NULL would dereference NULL. Without CONFIG_DEBUG_MUTEXES, mutex_destroy() is a no-op, but there is still no RAS DES state to tear down. So the patch makes the deinit path match the init path: if no rasdes_info was allocated, skip the RAS DES mutex teardown. Thanks, Shuvam _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic