dmaengine: dma-jz4780: fix NULL dereference in tx_status - #18
Open
wormuz wants to merge 1 commit into
Open
Conversation
jz4780_dma_tx_status() dereferences jzchan->desc->vdesc.tx.cookie without checking jzchan->desc. When the status of a completed transfer is queried after the channel finished (or was terminated) and no descriptor is active, jzchan->desc is NULL and the comparison faults. Reproduced on JZ4770 (RG350P handheld): querying residue from the MMC path after a completed transfer races the completion handler clearing jzchan->desc. Check jzchan->desc before comparing the cookie; with no active descriptor the residue lookup falls through to the default (0), which is correct for a completed transfer. Signed-off-by: wormuz <3341798+wormuz@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
jz4780_dma_tx_status() dereferences jzchan->desc->vdesc.tx.cookie without checking jzchan->desc. A status query racing the completion handler (which clears jzchan->desc) faults.
Reproduced on an RG350P handheld (JZ4770) via the MMC path querying residue after a completed transfer.