Re: V4L2: switch to register_chrdev_region: needs testing/review of release() handling

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Hans de Goede
Date: Sunday, August 17, 2008 - 2:29 pm

Hans Verkuil wrote:

I wasn't clear with delete I only meant the body.


I'm not talking about video_release, I'm talking about the following call chain:
video_device_unregister
cdev_del
kobj_put
v4l2_chardev_release
vfd->release

Which could happen in your old version (before the cdev_del was moved) even 
when a class device sysfs file was still open, and thus sysfs read / write 
callbacks which may use the (now released) vfd could still be made after the 
release.


That should not happen, if a process holds a sysfs file open the release 
callback for the device which owns the sysfs file should not get called, are 
you sure this is happening, if the device then does a read / write on this file 
mayhem could happen, or does the kernel catch this now a days and just returns 
-ENODEV?


Yes, that will fix the problem I was trying to describe too.


Well since the code was registering a class device which shared the same in 
memory struct, we needed an additional put on the cdev kobj, as once the 
refcount for that got to 0 the entire vfd struct including the class device 
would get released.

But now that you've moved the cdev_del this is moot, as now the ref_count won't 
reach zero until all users of the class device are done with it.


This is on my todo, but not very high atm.

Regards,

Hans
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: V4L2: switch to register_chrdev_region: needs testing/ ..., Hans de Goede, (Sun Aug 17, 2:29 pm)
Re: V4L2: switch to register_chrdev_region: needs testing/ ..., David Ellingsworth, (Sun Aug 17, 3:27 pm)