Re: [PATCH net v2] net: wwan: qcom_bam_dmux: fix TX DMA channel use-after-free
Stephan Gerhold <[email protected]>
| Newsgroups | org.kernel.vger.netdev,org.kernel.vger.linux-arm-msm,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Aug 08, 2026 at 04:34:57PM +0800, Hongyan Xu wrote: > The modem power-control interrupt can currently call bam_dmux_power_off() > and release dmux->tx while the host side still has an active runtime PM > vote and is preparing or issuing TX DMA descriptors. Runtime PM prevents > the runtime suspend callback from running in that window, but it does not > serialize the modem-driven pc interrupt with the command, netdev transmit, > or deferred wakeup paths that use dmux->tx. > > Serialize power-control state with a mutex and track the host pc vote under > that lock. If the modem reports pc=false while the host vote is still > active, acknowledge the pc transition but keep the DMA channels allocated. > This avoids releasing the TX channel underneath active users and avoids > terminating already queued commands such as BAM_DMUX_CMD_OPEN. > Unfortunately, this version won't work in practice because the modem will power down the DMA engine as soon as we acknowledge the pc transition. We need to release the TX channel (and bring the DMA engine into clean reset state) before sending the pc-ack (or refuse sending the pc-ack if the modem firmware is broken). The whole state management is unfortunately very tricky as I wrote in v1 [1]. Thanks, Stephan [1]: https://lore.kernel.org/linux-arm-msm/[email protected]/