All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] ALSA: echoaudio: use after free on error
Date: Wed, 05 Mar 2014 12:21:29 +0100	[thread overview]
Message-ID: <531708B9.6020007@bfs.de> (raw)
In-Reply-To: <20140305110715.GB16926@elgon.mountain>



Am 05.03.2014 12:07, schrieb Dan Carpenter:
> There are some places where we dereference "chip" in the error message
> but we've already freed it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
> index 166ec0c120d4..9f10c9e0df5e 100644
> --- a/sound/pci/echoaudio/echoaudio.c
> +++ b/sound/pci/echoaudio/echoaudio.c
> @@ -1990,8 +1990,8 @@ static int snd_echo_create(struct snd_card *card,
>  
>  	if ((chip->iores = request_mem_region(chip->dsp_registers_phys, sz,
>  					      ECHOCARD_NAME)) == NULL) {


this should read:
chip->iores = request_mem_region(chip->dsp_registers_phys, sz,ECHOCARD_NAME);
if (chip->iores == NULL) {

re,
 wh

> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot get memory region\n");
> +		snd_echo_free(chip);
>  		return -EBUSY;
>  	}
>  	chip->dsp_registers = (volatile u32 __iomem *)
> @@ -1999,8 +1999,8 @@ static int snd_echo_create(struct snd_card *card,
>  
>  	if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
>  			KBUILD_MODNAME, chip)) {
> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot grab irq\n");
> +		snd_echo_free(chip);
>  		return -EBUSY;
>  	}
>  	chip->irq = pci->irq;
> @@ -2012,8 +2012,8 @@ static int snd_echo_create(struct snd_card *card,
>  	if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
>  				sizeof(struct comm_page),
>  				&chip->commpage_dma_buf) < 0) {
> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot allocate the comm page\n");
> +		snd_echo_free(chip);
>  		return -ENOMEM;
>  	}
>  	chip->comm_page_phys = chip->commpage_dma_buf.addr;
> @@ -2291,8 +2291,8 @@ static int snd_echo_resume(struct device *dev)
>  
>  	if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
>  			KBUILD_MODNAME, chip)) {
> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot grab irq\n");
> +		snd_echo_free(chip);
>  		return -EBUSY;
>  	}
>  	chip->irq = pci->irq;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] ALSA: echoaudio: use after free on error
Date: Wed, 05 Mar 2014 11:21:29 +0000	[thread overview]
Message-ID: <531708B9.6020007@bfs.de> (raw)
In-Reply-To: <20140305110715.GB16926@elgon.mountain>



Am 05.03.2014 12:07, schrieb Dan Carpenter:
> There are some places where we dereference "chip" in the error message
> but we've already freed it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
> index 166ec0c120d4..9f10c9e0df5e 100644
> --- a/sound/pci/echoaudio/echoaudio.c
> +++ b/sound/pci/echoaudio/echoaudio.c
> @@ -1990,8 +1990,8 @@ static int snd_echo_create(struct snd_card *card,
>  
>  	if ((chip->iores = request_mem_region(chip->dsp_registers_phys, sz,
>  					      ECHOCARD_NAME)) = NULL) {


this should read:
chip->iores = request_mem_region(chip->dsp_registers_phys, sz,ECHOCARD_NAME);
if (chip->iores = NULL) {

re,
 wh

> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot get memory region\n");
> +		snd_echo_free(chip);
>  		return -EBUSY;
>  	}
>  	chip->dsp_registers = (volatile u32 __iomem *)
> @@ -1999,8 +1999,8 @@ static int snd_echo_create(struct snd_card *card,
>  
>  	if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
>  			KBUILD_MODNAME, chip)) {
> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot grab irq\n");
> +		snd_echo_free(chip);
>  		return -EBUSY;
>  	}
>  	chip->irq = pci->irq;
> @@ -2012,8 +2012,8 @@ static int snd_echo_create(struct snd_card *card,
>  	if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
>  				sizeof(struct comm_page),
>  				&chip->commpage_dma_buf) < 0) {
> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot allocate the comm page\n");
> +		snd_echo_free(chip);
>  		return -ENOMEM;
>  	}
>  	chip->comm_page_phys = chip->commpage_dma_buf.addr;
> @@ -2291,8 +2291,8 @@ static int snd_echo_resume(struct device *dev)
>  
>  	if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
>  			KBUILD_MODNAME, chip)) {
> -		snd_echo_free(chip);
>  		dev_err(chip->card->dev, "cannot grab irq\n");
> +		snd_echo_free(chip);
>  		return -EBUSY;
>  	}
>  	chip->irq = pci->irq;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2014-03-05 11:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 11:07 [patch] ALSA: echoaudio: use after free on error Dan Carpenter
2014-03-05 11:07 ` Dan Carpenter
2014-03-05 11:12 ` Takashi Iwai
2014-03-05 11:12   ` Takashi Iwai
2014-03-05 11:21 ` walter harms [this message]
2014-03-05 11:21   ` walter harms
2014-03-05 11:25   ` Takashi Iwai
2014-03-05 11:25     ` Takashi Iwai

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=531708B9.6020007@bfs.de \
    --to=wharms@bfs.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.