|
From: James S. <jsi...@tr...> - 2001-06-20 00:39:55
|
> In fact, I realised the driver doesn't really know when a process does an
> open(). Indeed, input_open_device is called only when the first process
> opens the device, and input_close_device when all processes closed it.
Are you sure about that? For one thing each time you open /dev/mouse and
/dev/event both devices call input_open_device. This is a case where the
same hardware is opened twice. Also in input_close_device we have
handle->open--;
I'm actually using this for power management.
> Frankly, I don't really like the fact that evdev can be kfreed both by
> evdev_disconnect and evdev_connect. Furthermore, the choice is done after
> the value of evdev->exist, whose access is not protected (possible bug if
> the last process releases the device while the device is being
> disconnected, on a smp machine (weird case, though))
I haven't thought about that problem but I have noticed the handle list
isn't protected with a lock. On a SMP machine you the list being scanned
and another thread removing or adding a new handle.
> Anyway, it seems we have to check evdev->exist before doing anything in
> evdev_{ioctl,read,write...}, I guess this is what caused the oops I got.
Please post the result of oops processed by ksymoops. This will help us
find the problem.
|