oresat / oresat-prucam-ar013x

Linux kernel module and PRU firmware for the Star Tracker's AR013x camera.
GNU General Public License v3.0
3 stars 2 forks source link

fix kernel error when you rmmod the kernel module without using it #7

Closed oliver-rew closed 3 years ago

oliver-rew commented 4 years ago

If you rmmod the kernel module without using the camera, it will dump this trace. Usually only happens on the first one after boot:

[  700.155691] remoteproc remoteproc1: powering up 4a334000.pru
[  700.156180] remoteproc remoteproc1: Booting fw image am335x-pru0-fw, size 64336
[  700.156232] remoteproc remoteproc1: remote processor 4a334000.pru is now up
[  709.221917] prucam: Freed 1228800 bytes
[  709.231937] ------------[ cut here ]------------
[  709.231985] WARNING: CPU: 0 PID: 2275 at lib/refcount.c:187 refcount_sub_and_test_checked+0xbc/0xc4
[  709.231990] refcount_t: underflow; use-after-free.
[  709.231996] Modules linked in: prucam(O-) pru_rproc irq_pruss_intc pruss pm33xx wkup_m3_ipc wkup_m3_rproc remoteproc virtio virtio_ring pruss_soc_bus usb_f_acm u_serial uio_pdrv_genirq usb_f_ncm uio usb_f_mass_storage usb_f_rndis u_ether libcomposite spidev
[  709.232061] CPU: 0 PID: 2275 Comm: rmmod Tainted: G           O      4.19.94-ti-r43 #1buster
[  709.232067] Hardware name: Generic AM33XX (Flattened Device Tree)
[  709.232107] [<c0113e18>] (unwind_backtrace) from [<c010e388>] (show_stack+0x20/0x24)
[  709.232132] [<c010e388>] (show_stack) from [<c0d20f5c>] (dump_stack+0x8c/0xa0)
[  709.232151] [<c0d20f5c>] (dump_stack) from [<c013c928>] (__warn.part.3+0xcc/0xe8)
[  709.232164] [<c013c928>] (__warn.part.3) from [<c013c9bc>] (warn_slowpath_fmt+0x78/0x94)
[  709.232178] [<c013c9bc>] (warn_slowpath_fmt) from [<c072c98c>] (refcount_sub_and_test_checked+0xbc/0xc4)
[  709.232193] [<c072c98c>] (refcount_sub_and_test_checked) from [<c072c9ac>] (refcount_dec_and_test_checked+0x18/0x1c)
[  709.232210] [<c072c9ac>] (refcount_dec_and_test_checked) from [<c0d25c98>] (kobject_put+0x2c/0x1e0)
[  709.232222] [<c0d25c98>] (kobject_put) from [<c0d25ed8>] (kset_unregister+0x28/0x2c)
[  709.232236] [<c0d25ed8>] (kset_unregister) from [<c08dec1c>] (class_unregister+0x34/0x54)
[  709.232249] [<c08dec1c>] (class_unregister) from [<c08dec64>] (class_destroy+0x28/0x2c)
[  709.232286] [<c08dec64>] (class_destroy) from [<bf1620a8>] (prucam_exit+0xe4/0x103c [prucam])
[  709.232332] [<bf1620a8>] (prucam_exit [prucam]) from [<c01ea418>] (sys_delete_module+0x1c4/0x280)
[  709.232347] [<c01ea418>] (sys_delete_module) from [<c0101000>] (ret_fast_syscall+0x0/0x54)
[  709.232355] Exception stack(0xecb7bfa8 to 0xecb7bff0)
[  709.232367] bfa0:                   00000000 0108e1a0 0108e1dc 00000800 79308600 79308600
[  709.232379] bfc0: 00000000 0108e1a0 0108e1a0 00000081 bed35590 bed3577c 00000001 00000002
[  709.232387] bfe0: 004faf5c bed3552c 004dfd97 b6d80d68
[  709.232395] ---[ end trace a76c20d6b3f459fc ]---
[  709.233547] prucam: module exit