Re: [PATCH 09/18] lirc driver for the Streamzap PC Receiver

From: Jonathan Corbet
Date: Thu Sep 11 2008 - 11:22:37 EST


[Yes, you said I shouldn't do more reviews of the posted code, but the
following was already pretty much written. I really only found one thing
in this driver, and I suspect it may not have been addressed yet.

This was set to be the last anyway, I'm pretty much out of time for now.]

jon

I'm curious about the following function:

> +static void stop_timer(struct usb_streamzap *sz)
> +{
> + unsigned long flags;
> +
> + spin_lock_irqsave(&sz->timer_lock, flags);
> + if (sz->timer_running) {

What happens if the timer fires right here?

> + sz->timer_running = 0;
> + del_timer_sync(&sz->delay_timer);
> + }
> + spin_unlock_irqrestore(&sz->timer_lock, flags);
> +}

The timer acquires the lock too, so this looks a bit like a deadlock to
me. Probably del_timer_sync() should be called without the lock?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/