Re: 2.6: spinlock bug in sound/oss/dmabuf.c

From: Andrew Morton
Date: Mon Jan 05 2004 - 23:05:32 EST


Christian Borntraeger <kernel@xxxxxxxxxxxxxxx> wrote:
>
> I think I found a bug in sound/oss/dmabuf.c
>
> DMAbuf_getrdbuffer holds a spinlock and possibly calls dma_reset_input. The
> dma_reset_input tries to hold that spinlock again:

yup, thanks.

diff -puN sound/oss/dmabuf.c~oss-dmabuf-deadlock-fix sound/oss/dmabuf.c
--- 25/sound/oss/dmabuf.c~oss-dmabuf-deadlock-fix 2004-01-05 20:02:05.000000000 -0800
+++ 25-akpm/sound/oss/dmabuf.c 2004-01-05 20:02:19.000000000 -0800
@@ -587,7 +587,6 @@ int DMAbuf_getrdbuffer(int dev, char **b
spin_unlock_irqrestore(&dmap->lock,flags);
timeout = interruptible_sleep_on_timeout(&adev->in_sleeper,
timeout);
- spin_lock_irqsave(&dmap->lock,flags);
if (!timeout) {
/* FIXME: include device name */
err = -EIO;
@@ -595,6 +594,7 @@ int DMAbuf_getrdbuffer(int dev, char **b
dma_reset_input(dev);
} else
err = -EINTR;
+ spin_lock_irqsave(&dmap->lock,flags);
}
spin_unlock_irqrestore(&dmap->lock,flags);


_

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