[RFC AR6000 patch V2] Set hardware unavailable during wext_ioctl when the suspend or rfkill is send

Werner Almesberger werner at openmoko.org
Tue Mar 31 08:18:50 CEST 2009


Michael Trimarchi wrote:
> ->ioctl_start ..... by a process, your lock is not acquire
> <--- in the middle you acquire the hardware lock and don't made the hw_unvalaible
> ---> release the lock at the end
> -> call ioctl_wext crash 

What I mean is something like this:

	ar6000_avail_ev()
	{
		up_write(&sem);
	}

	ar6000_unavail_ev()
	{
		down_write(&sem);
	}

	ar6000_do_ioctl()
	{
		...
	}

	ar6000_ioctl()
	{
		if (!down_read_trylock(&sem))
			return -EIO;
		ar6000_do_ioctl();
		up_read(&sem);
	}

If the unavailability event arrives while we're still in the ioctl,
the down_write just blocks until the ioctl ends and releases the
read lock.

- Werner



More information about the openmoko-kernel mailing list