Hello, I've got an issue with and USB/i2c device when i plug and unplug several times the usb device with a user-application using /dev/i2c-* file the kernel crashes because the data containing the struct i2c_adapter has been dealocated. In the probe function of my driver, i allocates my resource (an internal structure) that contains a struct i2c_adapter with the struct i2c_algorithm. In my disconnect function i unregister the i2c adapter and then i free the ressource. Take not that i use kref design patern to prevent free data that are still used. I look deeper in the i2c-dev (even on 3.19 release) and i notice that the callback function in the struct file_operations use struct i2c_client with an reference on a struct i2c_adapter and there is no mechanism to be sure that this reference has not be deallocated. When i unplug my usb-device, i unregister my i2c-adapter but my user-space application still hold a file descriptor with a struc i2c_client that point to an struct i2c_adapter already freed. I try to make a lock mechanism by adding a wait queue in the struct i2c_dev, to be sure that the adapter is no more used after a call to i2c_del_adapter, but it does not work and most of the time put the kernel in a dead lock. To conclude it is not a good solution (not safe) to lock in i2c_del_adapter, because if the usb device is plugged again before the user-space application use the file descriptor the kernel is locked. A thread is holding core_lock mutex calling __process_removed_adapter waiting for a call on release to unlock the wait_queue while another trying to register the new adapter is locked on core_lock mutex. I enclose my patch with this mail, knowing that it is a bad solution. Does anyone with a better knowledge on i2c-core has a working solution to this issue? Christian ROSALIE