hi,

i got a exception in rtdm_dev_register(). I didnt call rtdm_dev_unregister in 
my driver
and after insmodding the module again I got a oops.
xenomai 2.5.3, linux 2.6.32.11, x86 32bit, ubuntu 10.04.

Attached is the dmesg-trace and a small rtdm-module foo.c for reproduction:
insmod ./xeno_foo.ko
rmmod xeno_foo
insmod ./xeno_foo.ko -> oops

thanks
stefan
UNAME                 := $(shell uname -r)
PWD                   := $(shell pwd)

LINUXSOURCEDIR        := /usr/src/linux-headers-$(UNAME)

obj-m                 := xeno_foo.o
xeno_foo-y            := foo.o
EXTRA_CFLAGS          := -I/usr/src/linux-headers-$(UNAME)/include/xenomai

all::
        $(MAKE) -C $(LINUXSOURCEDIR) SUBDIRS=$(PWD) modules

clean::
        $(RM) .*.cmd *.cmd *.o *.ko *.mod.c *.order *.symvers
        $(RM) -R .tmp*

.PHONY: clean

#include <linux/module.h>
#include <rtdm/rtdm_driver.h>

MODULE_AUTHOR( "Stefan Kisdaroczi" );
MODULE_LICENSE( "GPL" );


int foo_open_nrt( struct rtdm_dev_context *context,
                         rtdm_user_info_t *user_info,
                         int oflags ) {
        return 0;
}

int foo_close_nrt( struct rtdm_dev_context *context,
                          rtdm_user_info_t *user_info ) {
        return 0;
}

struct rtdm_device foo_rtdm_device = {
        device_flags:           RTDM_NAMED_DEVICE,
        device_class:           RTDM_CLASS_EXPERIMENTAL,
        device_sub_class:       RTDM_SUBCLASS_GENERIC,
        device_name:            "foo0",
        proc_name:              "foo0",
        device_id:              0,

        open_nrt :              foo_open_nrt,
        ops: {
                close_nrt:      foo_close_nrt,
        },
};


int __init foo_init( void ) {
        return rtdm_dev_register( &foo_rtdm_device );
}

void __exit foo_exit( void ) {
        /* rtdm_dev_unregister( &foo_rtdm_device, 1000 ); */
}

module_init( foo_init );
module_exit( foo_exit );
[  185.000326] BUG: unable to handle kernel NULL pointer dereference at (null)
[  185.000340] IP: [<c01f873a>] rtdm_dev_register+0x2ea/0x470
[  185.000358] *pde = 00000000 
[  185.000365] Oops: 0000 [#1] SMP 
[  185.000373] last sysfs file: 
/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.2/0000:03:0d.0/host4/target4:0:1/4:0:1:0/block/sdb/uevent
[  185.000381] Modules linked in: xeno_foo(+) snd_intel8x0 snd_ac97_codec 
ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy hisax crc_ccitt isdn 
snd_seq_oss com20020_pci snd_seq_midi snd_rawmidi snd_seq_midi_event com20020 
arcnet snd_seq snd_timer snd_seq_device psmouse e752x_edac snd shpchp ppdev 
soundcore serio_raw edac_core snd_page_alloc lp dcdbas parport_pc parport 
usbhid floppy hid aic79xx e1000 scsi_transport_spi [last unloaded: xeno_foo]
[  185.000468] 
[  185.000476] Pid: 2216, comm: insmod Not tainted (2.6.32.11-xenomai-2.5.3 #2) 
Precision WorkStation 470    
[  185.000483] EIP: 0060:[<c01f873a>] EFLAGS: 00210202 CPU: 0
[  185.000491] EIP is at rtdm_dev_register+0x2ea/0x470
[  185.000498] EAX: 00000001 EBX: 000003a0 ECX: 000003a0 EDX: f832e06c
[  185.000503] ESI: 00000000 EDI: f833f06c EBP: f6595f54 ESP: f6595f34
[  185.000509]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  185.000515] Process insmod (pid: 2216, ti=f6594000 task=ecc1b340 
task.ti=f6594000)
[  185.000520] I-pipe domain Linux
[  185.000524] Stack:
[  185.000528]  c019ba17 f6595f54 c059b953 f833f060 000003a0 fffffffc f833f120 
00000000
[  185.000544] <0> f6595f5c f834200d f6595f88 c0101132 f833f120 c07723a0 
fffffffc f833f120
[  185.000563] <0> b7815ff4 f8342000 fffffffc f833f120 b7815ff4 f6595fac 
c0175371 00200046
[  185.000583] Call Trace:
[  185.000594]  [<c019ba17>] ? tracepoint_module_notify+0x27/0x30
[  185.000605]  [<c059b953>] ? notifier_call_chain+0x43/0x60
[  185.000616]  [<f834200d>] ? foo_init+0xd/0xf [xeno_foo]
[  185.000627]  [<c0101132>] ? do_one_initcall+0x32/0x1b0
[  185.000636]  [<f8342000>] ? foo_init+0x0/0xf [xeno_foo]
[  185.000648]  [<c0175371>] ? sys_init_module+0xb1/0x220
[  185.000657]  [<c0103145>] ? sysenter_do_call+0x12/0x16
[  185.000663] Code: bf 92 c0 21 f1 c1 e1 03 89 4d f0 01 c8 8b 30 8b 16 0f 18 
02 90 39 f0 0f 84 c8 00 00 00 89 5d ec 89 cb eb 1c 90 8d 74 26 00 8b 36 <8b> 06 
0f 18 00 90 a1 c0 bf 92 c0 01 d8 39 c6 0f 84 a2 00 00 00 
[  185.000756] EIP: [<c01f873a>] rtdm_dev_register+0x2ea/0x470 SS:ESP 
0068:f6595f34
[  185.000767] CR2: 0000000000000000
[  185.000772] ---[ end trace dbaf656208b2cc62 ]---

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to