Re: irda weirdness

From: Martin Diehl
Date: Mon Oct 06 2003 - 01:41:59 EST


On Mon, 6 Oct 2003, Patrick McHardy wrote:

> Not sure about this but I think the problem might lie in ircomm_tty_write:
>
> spin_lock_irqsave(&self->spinlock, flags);
> ...
> /* Copy data */
> if (from_user)
> copy_from_user(skb_put(skb,size), buf+len, size);
> else
> memcpy(skb_put(skb,size), buf+len, size);
> ...
> spin_unlock_irqrestore(&self->spinlock, flags);
>
> asm/uaccess.h:498 is might_sleep() in copy_from_user() in my tree so this
> might be it. No fix though, I just noticed this bug some time ago and
> completly forgot about it until now.

Good catch, that's definitedly a bug and probably at least one trigger in
Mikko's case.

Jean, I'm not familiar with ircomm so I'm not sure how to fix this. Do you
know what the spinlock is expected to protect here? If it's only to avoid
self->tx_skb getting changed below us I think it might be sufficient to
drop the spinlock during copy_from_user?

Martin

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