]> rtime.felk.cvut.cz Git - zynq/linux.git/commit
vdma: xilinx: Fix vdmatest driver crashing when unloading as a module xilinx-v2015.2
authorKedareswara rao Appana <appana.durga.rao@xilinx.com>
Wed, 3 Jun 2015 06:18:50 +0000 (11:48 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 3 Jun 2015 08:07:00 +0000 (10:07 +0200)
commit3f30b3337af61f1ed98f7185e37c6bf9202b3204
treecd749f04b8101c10d97fdbca86539e2b48224a3d
parentb141634cc7531ef9250748ca90d37f8c404f2b8b
vdma: xilinx: Fix vdmatest driver crashing when unloading as a module

This patch fixes the issue vdmatest
driver crashing when unloading as a module.

get_task_struct and put_task_struct manage a thread's reference count.
After we done get_task_struct, it will always be safe to access that memory,
until we release it.get_task_struct and put_task_struct manage a thread's reference count.
If we call put_task_struct and we are the last one with a reference count, it does a bunch of
cleanup.

crash dump:
zynq> rmmod vdmatest
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = 7e370000
[00000000] *pgd=3e133831, *pte=00000000, *ppte=00000000
Internal error: Oops - BUG: 17 [#1] PREEMPT SMP ARM
Modules linked in: vdmatest(-)
CPU: 1 PID: 633 Comm: rmmod Not tainted 4.0.0-xilinx-25035-gbf14dce-dirty #29
Hardware name: Xilinx Zynq Platform
task: 7e103100 ti: 7e1e4000 task.ti: 7e1e4000
PC is at exit_creds+0x14/0x84
LR is at __put_task_struct+0x10/0x58
pc : [<400375d0>]    lr : [<4001ead4>]    psr: 60000013
sp : 7e1e5ec8  ip : 00000000  fp : 3f0015f0
r10: 7e26ea38  r9 : 00200200  r8 : 00100100
r7 : 7d29554c  r6 : 00000000  r5 : 7e1d8a48  r4 : 7e1d8a40
r3 : 00000000  r2 : 00000000  r1 : 60000013  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 18c5387d  Table: 3e37004a  DAC: 00000015
Process rmmod (pid: 633, stack limit = 0x7e1e4210)
Stack: (0x7e1e5ec8 to 0x7e1e6000)
5ec0:                   7e1d8a40 4001ead4 7e1d8a40 40036448 7d29554c 7d295540
5ee0: 7d2955c0 7d295580 7d29554c 3f0004e0 7e127400 7d29554c 00000000 7e127410
5f00: 3f001620 7e127444 00000081 4000df64 7e1e4000 00000000 00000000 4026f71c
5f20: 4026f704 7e127410 3f001620 4026dfac 3f001620 7e127410 3f001620 4026e5e4
5f40: 3f001620 00000880 3effbf68 4026dd48 3f001664 4006f2a4 36f52000 616d6476
5f60: 74736574 45535500 00001000 7e1dc07c 7e1dc040 00001000 36f51000 4000df64
5f80: 7e1e4000 00000000 00000000 400a4b94 36f523ff 000fe1e8 3effbf68 00000000
5fa0: 00000001 4000dde0 3effbf68 00000000 3effbf68 00000880 000f21bb 000f21c8
5fc0: 3effbf68 00000000 00000001 00000081 00000001 00000000 3effbe8c 00000000
5fe0: 000f21c8 3effbaf0 0002cd74 36e50a3c 60000010 3effbf68 00000000 00000000
[<400375d0>] (exit_creds) from [<4001ead4>] (__put_task_struct+0x10/0x58)
[<4001ead4>] (__put_task_struct) from [<40036448>] (kthread_stop+0x90/0x98)
[<40036448>] (kthread_stop) from [<3f0004e0>] (xilinx_vdmatest_remove+0x54/0xe4 [vdmatest])
[<3f0004e0>] (xilinx_vdmatest_remove [vdmatest]) from [<4026f71c>] (platform_drv_remove+0x18/0x30)
[<4026f71c>] (platform_drv_remove) from [<4026dfac>] (__device_release_driver+0x7c/0xc0)
[<4026dfac>] (__device_release_driver) from [<4026e5e4>] (driver_detach+0x84/0xac)
[<4026e5e4>] (driver_detach) from [<4026dd48>] (bus_remove_driver+0x64/0x8c)
[<4026dd48>] (bus_remove_driver) from [<4006f2a4>] (SyS_delete_module+0x154/0x1d0)
[<4006f2a4>] (SyS_delete_module) from [<4000dde0>] (ret_fast_syscall+0x0/0x34)
Code: e1a04000 e5903304 e3a02000 e5900300 (e5933000)
---[ end trace ef75749866135c58 ]---

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/dma/xilinx/vdmatest.c