当前位置: 技术问答>linux和unix
求助:open设备时内核报错:kernel NULL pointer
来源: 互联网 发布时间:2016-10-19
本文导语: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pc = 00000000 *pde = 00000000 Oops: 0000 [#1] Modules linked in: Pid : 410, Comm: open_dev PC is at _stext+0x7f7ff000/0x30 PC : 00000000 SP : 87f8be6...
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pc = 00000000
*pde = 00000000
Oops: 0000 [#1]
Modules linked in:
Pid : 410, Comm: open_dev
PC is at _stext+0x7f7ff000/0x30
PC : 00000000 SP : 87f8be64 SR : 40008000 TEA : c010e210 Not tainted
R0 : ffffffe0 R1 : 00000000 R2 : 40008001 R3 : 00024000
R4 : 80df9100 R5 : 80a91540 R6 : 81622f34 R7 : 80ba8724
R8 : 00000000 R9 : 80857ca8 R10 : 87f8be5c R11 : 8160f3a0
R12 : 817f3200 R13 : 81687ba0 R14 : 80849854
MACH: 00006d36 MACL: bbbe0000 GBR : 2967b450 PR : 00000000
Call trace:
[] kobj_lookup+0x178/0x1c0
[] video_open+0xe0/0x2e0
[] chrdev_open+0xee/0x280
[] __dentry_open+0xec/0x2a0
[] chrdev_open+0x0/0x280
[] nameidata_to_filp+0x4e/0x80
[] do_filp_open+0x48/0x60
[] vtconsole_class_init+0x58/0x100
[] get_unused_fd_flags+0xae/0x120
[] do_sys_open+0x2e/0x100
[] do_sys_open+0x40/0x100
[] sys_open+0x14/0x20
[] sys_open+0x0/0x20
[] syscall_call+0xa/0xe
Process: open_dev (pid: 410, stack limit = 87f8a001)
Stack: (0x87f8be64 to 0x87f8c000)
be60: 8160f3a0 817eb400 80a06a18 80a468c0 87f8be90 81687ba0 80bbfad4
be80: 8160f3a0 817eb400 00000000 00000000 80872b0e 87f8beb0 8160f3a0 8170c7c0
bea0: 00000000 00000000 8170c780 00000000 81687ba0 00000000 8086d14c 87f8bed8
bec0: fffff000 80872a20 815f41a0 81687c1c 00000000 8160f3a0 8160f3e0 8160f3bc
bee0: 87ecb81c 81687ba0 8086d3ee 87f8bf0c fffff000 7bf3fe90 ffffff9c 87f86000
bf00: 00000003 8160f3a0 00000000 8086d468 87f8bf18 00000000 87ecb81c 815f41a0
bf20: 2957e000 80cbb7b8 87df5294 00000101 00000001 00000000 87f8bf54 87f2e000
bf40: 87f8a000 815e8c80 87f86000 8086cfce 87f8bf54 00000000 8086d4ae 00000001
bf60: 00000000 8160f3a0 8086d4c0 87f8bf78 00000003 00000000 8086d5b4 87f8bf98
bf80: 00000000 00000514 00000000 00000021 0000004c 8086d5a0 808088f8 00000000
bfa0: 00000000 00000450 00400400 00000005 7bf3ff4d 00000000 7bf3fe90 7bf3fe4c
bfc0: 2957de1c 00400488 00000000 00000000 296777b8 00000000 00000000 7bf3fdf0
bfe0: 29609114 00400424 00008001 2967b450 4a8568ad 7c96ec99 0000004c 00000160
Segmentation fault
以上是报错信息,我的开发板是sh4体系结构的处理器,linux2.6的内核,我把v4l和飞利浦的摄像头驱动编进内核后,摄像头能识别,注册在/dev/video。因为摄像头上有话筒,所以也注册了/dev/audio。我用open函数写了一个简单的测试程序,能打开/dev/audio,但是一打开/dev/video时内核就报出以上错误,有时候还提示字节不对齐unaligned kernel access。
小弟不是专门搞驱动的,这方面不太懂,能给我指点一下么?说说通过以上信息能看出问题在哪啊?是不是驱动程序有问题啊?
谢谢!!!
pc = 00000000
*pde = 00000000
Oops: 0000 [#1]
Modules linked in:
Pid : 410, Comm: open_dev
PC is at _stext+0x7f7ff000/0x30
PC : 00000000 SP : 87f8be64 SR : 40008000 TEA : c010e210 Not tainted
R0 : ffffffe0 R1 : 00000000 R2 : 40008001 R3 : 00024000
R4 : 80df9100 R5 : 80a91540 R6 : 81622f34 R7 : 80ba8724
R8 : 00000000 R9 : 80857ca8 R10 : 87f8be5c R11 : 8160f3a0
R12 : 817f3200 R13 : 81687ba0 R14 : 80849854
MACH: 00006d36 MACL: bbbe0000 GBR : 2967b450 PR : 00000000
Call trace:
[] kobj_lookup+0x178/0x1c0
[] video_open+0xe0/0x2e0
[] chrdev_open+0xee/0x280
[] __dentry_open+0xec/0x2a0
[] chrdev_open+0x0/0x280
[] nameidata_to_filp+0x4e/0x80
[] do_filp_open+0x48/0x60
[] vtconsole_class_init+0x58/0x100
[] get_unused_fd_flags+0xae/0x120
[] do_sys_open+0x2e/0x100
[] do_sys_open+0x40/0x100
[] sys_open+0x14/0x20
[] sys_open+0x0/0x20
[] syscall_call+0xa/0xe
Process: open_dev (pid: 410, stack limit = 87f8a001)
Stack: (0x87f8be64 to 0x87f8c000)
be60: 8160f3a0 817eb400 80a06a18 80a468c0 87f8be90 81687ba0 80bbfad4
be80: 8160f3a0 817eb400 00000000 00000000 80872b0e 87f8beb0 8160f3a0 8170c7c0
bea0: 00000000 00000000 8170c780 00000000 81687ba0 00000000 8086d14c 87f8bed8
bec0: fffff000 80872a20 815f41a0 81687c1c 00000000 8160f3a0 8160f3e0 8160f3bc
bee0: 87ecb81c 81687ba0 8086d3ee 87f8bf0c fffff000 7bf3fe90 ffffff9c 87f86000
bf00: 00000003 8160f3a0 00000000 8086d468 87f8bf18 00000000 87ecb81c 815f41a0
bf20: 2957e000 80cbb7b8 87df5294 00000101 00000001 00000000 87f8bf54 87f2e000
bf40: 87f8a000 815e8c80 87f86000 8086cfce 87f8bf54 00000000 8086d4ae 00000001
bf60: 00000000 8160f3a0 8086d4c0 87f8bf78 00000003 00000000 8086d5b4 87f8bf98
bf80: 00000000 00000514 00000000 00000021 0000004c 8086d5a0 808088f8 00000000
bfa0: 00000000 00000450 00400400 00000005 7bf3ff4d 00000000 7bf3fe90 7bf3fe4c
bfc0: 2957de1c 00400488 00000000 00000000 296777b8 00000000 00000000 7bf3fdf0
bfe0: 29609114 00400424 00008001 2967b450 4a8568ad 7c96ec99 0000004c 00000160
Segmentation fault
以上是报错信息,我的开发板是sh4体系结构的处理器,linux2.6的内核,我把v4l和飞利浦的摄像头驱动编进内核后,摄像头能识别,注册在/dev/video。因为摄像头上有话筒,所以也注册了/dev/audio。我用open函数写了一个简单的测试程序,能打开/dev/audio,但是一打开/dev/video时内核就报出以上错误,有时候还提示字节不对齐unaligned kernel access。
小弟不是专门搞驱动的,这方面不太懂,能给我指点一下么?说说通过以上信息能看出问题在哪啊?是不是驱动程序有问题啊?
谢谢!!!
|
楼主把video_open()的代码贴上来吧,空指针的问题应该好解决
|
字节没对齐,就检查一下你的结构定义,是不是按4字节定义的.
|
遇到空指针了被
Call trace:
[] kobj_lookup+0x178/0x1c0
[] video_open+0xe0/0x2e0
[] chrdev_open+0xee/0x280
[] __dentry_open+0xec/0x2a0
[] chrdev_open+0x0/0x280
[] nameidata_to_filp+0x4e/0x80
[] do_filp_open+0x48/0x60
[] vtconsole_class_init+0x58/0x100
[] get_unused_fd_flags+0xae/0x120
[] do_sys_open+0x2e/0x100
[] do_sys_open+0x40/0x100
[] sys_open+0x14/0x20
[] sys_open+0x0/0x20
[] syscall_call+0xa/0xe
这里不打出来栈调用了吗、挂掉钱的 倒数第二步[] video_open+0xe0/0x2e0
这个函数的开头偏移0xe0处调用了什么东西最终调用 kobj_lookup+0x178/0x1c0
的时候遇到了空指针,加打印调试吧
Call trace:
[] kobj_lookup+0x178/0x1c0
[] video_open+0xe0/0x2e0
[] chrdev_open+0xee/0x280
[] __dentry_open+0xec/0x2a0
[] chrdev_open+0x0/0x280
[] nameidata_to_filp+0x4e/0x80
[] do_filp_open+0x48/0x60
[] vtconsole_class_init+0x58/0x100
[] get_unused_fd_flags+0xae/0x120
[] do_sys_open+0x2e/0x100
[] do_sys_open+0x40/0x100
[] sys_open+0x14/0x20
[] sys_open+0x0/0x20
[] syscall_call+0xa/0xe
这里不打出来栈调用了吗、挂掉钱的 倒数第二步[] video_open+0xe0/0x2e0
这个函数的开头偏移0xe0处调用了什么东西最终调用 kobj_lookup+0x178/0x1c0
的时候遇到了空指针,加打印调试吧