I am trying to test g_hid driver but facing issues while removing g_hid using rmmod
root@imx6ulnxpuiopb:~# modprobe g_hid
root@imx6ulnxpuiopb:~# rmmod g_hid
root@imx6ulnxpuiopb:~# modprobe g_hid
Segmentation fault
Kernel: Linux imx6ulnxpuiopb 4.1.15-1.2.0+g77f6154 #82 SMP PREEMPT Fri Sep 1 17:24:23 IST 2017 armv7l GNU/Linux
I split the loading of modules and I tried following commands, I think insmod in a particular scenario causing this issue.
insmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/fs/configfs/configfs.ko
rmmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/fs/configfs/configfs.ko
I tried above commands for 3 times without any problem
insmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/drivers/usb/gadget/libcomposite.ko
rmmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/drivers/usb/gadget/libcomposite.ko
I tried above commands for 3 times without any problem
insmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/drivers/usb/gadget/function/usb_f_hid.ko
rmmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/drivers/usb/gadget/function/usb_f_hid.ko
I tried above commands for 3 times without any problem
insmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/drivers/usb/gadget/legacy/g_hid.ko
rmmod /lib/modules/4.1.15-1.2.0+g77f6154/kernel/drivers/usb/gadget/legacy/g_hid.ko
This is problematic part and dumps the core on second attempt.
If it would have been a driver issue it should show kernel panic instead its dumping the core.
Can anyone please help me on this?