spinlock protection on data question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux