Re: Critical sections between tasklets and other kernel code

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

 



--- Shripal <shripal_bagadia@yahoo.com> wrote:
> I am designing a device driver for linux kernel 2.4.
> 
> When an interrupt occurs, the ISR schedules a tasklet for further
> processing. I
> have some data that is accessed from both, ioctl and the tasklet.
> Do I need to
> protect this data using critical section?
> 

If the data is simply read, no.


> If user calls ioctl, execution switches to kernel mode. If ioctl is
> modifying
> the common data structure when an interrupt occurs, can the tasklet
> (scheduled
> by ISR) run before execution gets back to ioctl? If this is
> possible then will
> putting the tasklet on scheduler queue avoid such scenario?
> 

I believe that the tasklet *may* run before execution gets back to
the ioctl, and "scheduling" the tasklet will not guarantee that it
will not.  Sounds like the possibility exists for a race condition
here.  To be safe, protect your data structure!

Harmony,

--Christine


__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com
--
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