Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1375609 > unrolled thread

[PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on remove

Started byStanimir Varbanov <stanimir.varbanov@linaro.org>
First post2016-04-11 10:40 +0200
Last post2016-04-13 00:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on remove Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2016-04-11 10:40 +0200
    Re: [PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on  remove Andy Gross <andy.gross@linaro.org> - 2016-04-13 00:10 +0200

#1375609 — [PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on remove

FromStanimir Varbanov <stanimir.varbanov@linaro.org>
Date2016-04-11 10:40 +0200
Subject[PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on remove
Message-ID<rmFy2-2Qu-1@gated-at.bofh.it>
Building the driver as a module and when removing the already
inserted module gives below:

[ 1389.392788] Unable to handle kernel paging request at virtual address ffffffbdc000001c
[ 1389.421321] pgd = ffffffc02fa87000
[ 1389.447899] [ffffffbdc000001c] *pgd=0000000000000000, *pud=0000000000000000
[ 1389.460142] Internal error: Oops: 96000006 [#1] PREEMPT SMP
[ 1389.466963] Modules linked in: qcom_bam_dma(-)
[ 1389.486608] CPU: 2 PID: 2442 Comm: rmmod Not tainted 4.2.0+ #407
[ 1389.493885] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 1389.501196] task: ffffffc035bae2c0 ti: ffffffc0368a8000 task.ti: ffffffc0368a8000
[ 1389.508566] PC is at __free_pages+0xc/0x40
[ 1389.515893] LR is at free_pages.part.93+0x30/0x38
[ 1389.523141] pc : [<ffffffc00016180c>] lr : [<ffffffc00016197c>] pstate: 80000145
[ 1389.530602] sp : ffffffc0368abc20
[ 1389.537931] x29: ffffffc0368abc20 x28: ffffffc0368a8000
[ 1389.549153] x27: 0000000000000000 x26: 0000000000000000
[ 1389.560412] x25: ffffffc000cb2000 x24: 0000000000000170
[ 1389.571530] x23: 0000000000000004 x22: ffffffc036bc5010
[ 1389.582721] x21: ffffffc036bc5010 x20: 0000000000000000
[ 1389.593981] x19: 0000000000000002 x18: 0000007fcbc8e8b0
[ 1389.605301] x17: 0000007f9b8226ec x16: ffffffc0002089e8
[ 1389.616647] x15: 0000007f9b8a0588 x14: 0ffffffffffffffc
[ 1389.628039] x13: 0000000000000030 x12: 0000000000000000
[ 1389.639436] x11: 0000000000000008 x10: ffffffc000ecc000
[ 1389.650872] x9 : ffffffc035bae2c0 x8 : ffffffc035bae9a8
[ 1389.662367] x7 : ffffffc035bae9a0 x6 : 0000000000000000
[ 1389.673906] x5 : ffffffbdc000001c x4 : 0000000080000000
[ 1389.685475] x3 : ffffffbdc0000000 x2 : 0000004080000000
[ 1389.697049] x1 : 0000000000000003 x0 : ffffffbdc0000000

The memory has been already freed by bam_free_chan() so fix this
by skiping already freed memory.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
---
 drivers/dma/qcom/bam_dma.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c
index d5e0a9c3ad5d..a486bc0f82e0 100644
--- a/drivers/dma/qcom/bam_dma.c
+++ b/drivers/dma/qcom/bam_dma.c
@@ -1234,6 +1234,9 @@ static int bam_dma_remove(struct platform_device *pdev)
 		bam_dma_terminate_all(&bdev->channels[i].vc.chan);
 		tasklet_kill(&bdev->channels[i].vc.task);
 
+		if (!bdev->channels[i].fifo_virt)
+			continue;
+
 		dma_free_wc(bdev->dev, BAM_DESC_FIFO_SIZE,
 			    bdev->channels[i].fifo_virt,
 			    bdev->channels[i].fifo_phys);
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1377348 — Re: [PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on remove

FromAndy Gross <andy.gross@linaro.org>
Date2016-04-13 00:10 +0200
SubjectRe: [PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on remove
Message-ID<rneFs-6vF-11@gated-at.bofh.it>
In reply to#1375609
On Mon, Apr 11, 2016 at 11:38:38AM +0300, Stanimir Varbanov wrote:
> Building the driver as a module and when removing the already
> inserted module gives below:
> 
> [ 1389.392788] Unable to handle kernel paging request at virtual address ffffffbdc000001c
> [ 1389.421321] pgd = ffffffc02fa87000
> [ 1389.447899] [ffffffbdc000001c] *pgd=0000000000000000, *pud=0000000000000000
> [ 1389.460142] Internal error: Oops: 96000006 [#1] PREEMPT SMP
> [ 1389.466963] Modules linked in: qcom_bam_dma(-)
> [ 1389.486608] CPU: 2 PID: 2442 Comm: rmmod Not tainted 4.2.0+ #407
> [ 1389.493885] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
> [ 1389.501196] task: ffffffc035bae2c0 ti: ffffffc0368a8000 task.ti: ffffffc0368a8000
> [ 1389.508566] PC is at __free_pages+0xc/0x40
> [ 1389.515893] LR is at free_pages.part.93+0x30/0x38
> [ 1389.523141] pc : [<ffffffc00016180c>] lr : [<ffffffc00016197c>] pstate: 80000145
> [ 1389.530602] sp : ffffffc0368abc20
> [ 1389.537931] x29: ffffffc0368abc20 x28: ffffffc0368a8000
> [ 1389.549153] x27: 0000000000000000 x26: 0000000000000000
> [ 1389.560412] x25: ffffffc000cb2000 x24: 0000000000000170
> [ 1389.571530] x23: 0000000000000004 x22: ffffffc036bc5010
> [ 1389.582721] x21: ffffffc036bc5010 x20: 0000000000000000
> [ 1389.593981] x19: 0000000000000002 x18: 0000007fcbc8e8b0
> [ 1389.605301] x17: 0000007f9b8226ec x16: ffffffc0002089e8
> [ 1389.616647] x15: 0000007f9b8a0588 x14: 0ffffffffffffffc
> [ 1389.628039] x13: 0000000000000030 x12: 0000000000000000
> [ 1389.639436] x11: 0000000000000008 x10: ffffffc000ecc000
> [ 1389.650872] x9 : ffffffc035bae2c0 x8 : ffffffc035bae9a8
> [ 1389.662367] x7 : ffffffc035bae9a0 x6 : 0000000000000000
> [ 1389.673906] x5 : ffffffbdc000001c x4 : 0000000080000000
> [ 1389.685475] x3 : ffffffbdc0000000 x2 : 0000004080000000
> [ 1389.697049] x1 : 0000000000000003 x0 : ffffffbdc0000000
> 
> The memory has been already freed by bam_free_chan() so fix this
> by skiping already freed memory.
> 
> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

Reviewed-by: Andy Gross <andy.gross@linaro.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web