Commit 219df0f
mmc: moxart: Fix reference count leaks in moxart_probe
[ Upstream commit 8105c2a ]
The issue happens in several error handling paths on two refcounted
object related to the object "host" (dma_chan_rx, dma_chan_tx). In
these paths, the function forgets to decrement one or both objects'
reference count increased earlier by dma_request_chan(), causing
reference count leaks.
Fix it by balancing the refcounts of both objects in some error
handling paths. In correspondence with the changes in moxart_probe(),
IS_ERR() is replaced with IS_ERR_OR_NULL() in moxart_remove() as well.
Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Link: https://lore.kernel.org/r/20211009041918.28419-1-xiongx18@fudan.edu.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 38608d3 commit 219df0f
1 file changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
627 | 635 | | |
628 | 636 | | |
629 | 637 | | |
| |||
678 | 686 | | |
679 | 687 | | |
680 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
681 | 693 | | |
682 | 694 | | |
683 | 695 | | |
| |||
690 | 702 | | |
691 | 703 | | |
692 | 704 | | |
693 | | - | |
| 705 | + | |
694 | 706 | | |
695 | | - | |
| 707 | + | |
696 | 708 | | |
697 | 709 | | |
698 | 710 | | |
| |||
0 commit comments