mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: perex@perex.cz, akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] OSS: mpu401, fix deadlock
Date: Mon, 29 Jun 2009 18:09:49 +0200	[thread overview]
Message-ID: <s5hvdmfm376.wl%tiwai@suse.de> (raw)
In-Reply-To: <1246291414-3563-1-git-send-email-jirislaby@gmail.com>

At Mon, 29 Jun 2009 18:03:34 +0200,
Jiri Slaby wrote:
> 
> If somebody cares about oss at all.

... or want to save somebody else's time to find out the same bug :)

> --
> mpu401_chk_version is called with a spin lock already held. Don't take it
> again.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

Applied now.  Thanks.


Takashi

> ---
>  sound/oss/mpu401.c |   16 +++-------------
>  1 files changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/oss/mpu401.c b/sound/oss/mpu401.c
> index 6c0a770..1b2316f 100644
> --- a/sound/oss/mpu401.c
> +++ b/sound/oss/mpu401.c
> @@ -926,31 +926,21 @@ static struct midi_operations mpu401_midi_operations[MAX_MIDI_DEV];
>  static void mpu401_chk_version(int n, struct mpu_config *devc)
>  {
>  	int tmp;
> -	unsigned long flags;
>  
>  	devc->version = devc->revision = 0;
>  
> -	spin_lock_irqsave(&devc->lock,flags);
> -	if ((tmp = mpu_cmd(n, 0xAC, 0)) < 0)
> -	{
> -		spin_unlock_irqrestore(&devc->lock,flags);
> +	tmp = mpu_cmd(n, 0xAC, 0);
> +	if (tmp < 0)
>  		return;
> -	}
>  	if ((tmp & 0xf0) > 0x20)	/* Why it's larger than 2.x ??? */
> -	{
> -		spin_unlock_irqrestore(&devc->lock,flags);
>  		return;
> -	}
>  	devc->version = tmp;
>  
> -	if ((tmp = mpu_cmd(n, 0xAD, 0)) < 0)
> -	{
> +	if ((tmp = mpu_cmd(n, 0xAD, 0)) < 0) {
>  		devc->version = 0;
> -		spin_unlock_irqrestore(&devc->lock,flags);
>  		return;
>  	}
>  	devc->revision = tmp;
> -	spin_unlock_irqrestore(&devc->lock,flags);
>  }
>  
>  int attach_mpu401(struct address_info *hw_config, struct module *owner)
> -- 
> 1.6.3.2
> 

      reply	other threads:[~2009-06-29 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-29 16:03 Jiri Slaby
2009-06-29 16:09 ` Takashi Iwai [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=s5hvdmfm376.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    /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

all inboxes | Powered by JetHome®