Notes:
indydog_open has a race
indydog_open(struct inode *inode, struct file *file)
{
if( indydog_alive )
return -EBUSY;
...
indydog_alive = 1;
return 0;
}
If 2 opens happen simultaneously, there can be 2 tasks which
both see indydog_alive as 0 and both set it to 1, successfully opening
the device. Block and char devices hold the BKL before calling the
driver's open function, but misc devices don't do the same.
The BKL is not needed in the release function, as far as I can
see. Alan's softdog.c driver uses atomic ops without BKL to do the
same thing as your driver.
|