public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Christian Borntraeger <kernel@borntraeger.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6: spinlock bug in sound/oss/dmabuf.c
Date: Mon, 5 Jan 2004 20:03:51 -0800	[thread overview]
Message-ID: <20040105200351.7683d112.akpm@osdl.org> (raw)
In-Reply-To: <200401051828.52363.kernel@borntraeger.net>

Christian Borntraeger <kernel@borntraeger.net> 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);
 

_


      reply	other threads:[~2004-01-06  4:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-05 17:28 2.6: spinlock bug in sound/oss/dmabuf.c Christian Borntraeger
2004-01-06  4:03 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040105200351.7683d112.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=kernel@borntraeger.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox