[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
spinlock protection on data question
If I have a some data structure that is used by two driver functions, for
instance:
driver_read(){
spin_lockirq_save(&(data->spinlock), flags)
/* use data*/
spinlock_irq_restore(&(data->spinlock), flags);
}
driver_disconnect()
{
if(data)
{
kfree(data);
}
}
I see a problem here if for instance disconnect freed the data while read was
using it. Am I right?
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/