atm: idt77252: shut down tst timer on probe failure - #3
Open
g4tkey wants to merge 1 commit into
Open
Conversation
init_card() calls fill_tst(), which arms tst_timer to switch the transmit schedule table. If the subsequent idt77252_dev_open() call fails, probe tears down the card and frees its memory while the timer may still be pending or running. Shut down the timer synchronously before deinitializing the card so the callback cannot access released card resources or be rearmed during teardown. The timer is initialized before every path to this error label, so shutting it down is also safe for earlier probe failures. This issue was found by a static analysis tool. Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
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.
Summary
tst_timerbefore probe error teardownidt77252_devstateDetails
init_card()callsfill_tst(), which can armtst_timer. If the lateridt77252_dev_open()call fails, probe reacheserr_out_deinit_card, releasescard resources, and frees
cardwithout first stopping the timer.timer_shutdown_sync()is safe on earlier paths to the same label because thetimer is initialized before those paths.
Validation
scripts/checkpatch.pl --strict: 0 errors, 0 warningsinit_card()throughfill_tst()/mod_timer()This issue was found by a static analysis tool.