Re: spinlock protection on data question

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

 



On Wed, 7 Aug 2002, anton wilson wrote:

> driver_read(struct file *file)
> {
>    data = (struct mydata *) file->private_data;
>    
>    if(data){
>      spin_lockirq_save(&locktable[data->number], flags)
>  
>      /* .... */ 
> 
>    }
> }
> 
> This is still bad because I have to access the data to find out which lock to 
> use. Secondly, I don't have any guarantees that data is not null between the 
> time I check and the time I access. The only think I can see is to have 
> another global lock. . . Not sure what else I can do.

Not to mention being really susceptible to user craziness ie data->number.

	Zwane

-- 
function.linuxpower.ca

--
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