linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix leak in btaudio
@ 2003-09-29 17:04 davej
  2003-10-01 18:31 ` Sander van Malssen
  0 siblings, 1 reply; 3+ messages in thread
From: davej @ 2003-09-29 17:04 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/btaudio.c linux-2.5/sound/oss/btaudio.c
--- bk-linus/sound/oss/btaudio.c	2003-09-08 00:49:05.000000000 +0100
+++ linux-2.5/sound/oss/btaudio.c	2003-09-08 01:32:13.000000000 +0100
@@ -177,8 +177,11 @@ static int alloc_buffer(struct btaudio *
 		bta->risc_size = PAGE_SIZE;
 		bta->risc_cpu = pci_alloc_consistent
 			(bta->pci, bta->risc_size, &bta->risc_dma);
-		if (NULL == bta->risc_cpu)
+		if (NULL == bta->risc_cpu) {
+			pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->dma);
+			bta->buf_cpu = NULL;
 			return -ENOMEM;
+		}
 	}
 	return 0;
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix leak in btaudio
  2003-09-29 17:04 [PATCH] fix leak in btaudio davej
@ 2003-10-01 18:31 ` Sander van Malssen
  2003-10-01 18:35   ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Sander van Malssen @ 2003-10-01 18:31 UTC (permalink / raw)
  To: davej; +Cc: torvalds, linux-kernel

On Monday, 29 September 2003 at 18:04:34 +0100, davej@redhat.com wrote:

> +			pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->dma);


Surely bta->dma must be bta->buf_dma, like so:


--- linux-2.6/sound/oss/btaudio.c.~1~	2003-09-30 14:11:13.000000000 +0200
+++ linux-2.6/sound/oss/btaudio.c	2003-10-01 20:28:47.000000000 +0200
@@ -178,7 +178,7 @@
 		bta->risc_cpu = pci_alloc_consistent
 			(bta->pci, bta->risc_size, &bta->risc_dma);
 		if (NULL == bta->risc_cpu) {
-			pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->dma);
+			pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->buf_dma);
 			bta->buf_cpu = NULL;
 			return -ENOMEM;
 		}




Cheers,
Sander

-- 
     Sander van Malssen -- svm@kozmix.org -- http://www.kozmix.org/
      http://www.peteandtommysdayout.com/ -- http://www.1-2-5.net/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix leak in btaudio
  2003-10-01 18:31 ` Sander van Malssen
@ 2003-10-01 18:35   ` Dave Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Jones @ 2003-10-01 18:35 UTC (permalink / raw)
  To: Sander van Malssen, torvalds, linux-kernel

On Wed, Oct 01, 2003 at 08:31:45PM +0200, Sander van Malssen wrote:
 > On Monday, 29 September 2003 at 18:04:34 +0100, davej@redhat.com wrote:
 > 
 > > +			pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->dma);
 > 
 > 
 > Surely bta->dma must be bta->buf_dma, like so:
 > 
 > 
 > --- linux-2.6/sound/oss/btaudio.c.~1~	2003-09-30 14:11:13.000000000 +0200
 > +++ linux-2.6/sound/oss/btaudio.c	2003-10-01 20:28:47.000000000 +0200
 > @@ -178,7 +178,7 @@
 >  		bta->risc_cpu = pci_alloc_consistent
 >  			(bta->pci, bta->risc_size, &bta->risc_dma);
 >  		if (NULL == bta->risc_cpu) {
 > -			pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->dma);
 > +			pci_free_consistent(bta->pci, bta->buf_size, bta->buf_cpu, bta->buf_dma);
 >  			bta->buf_cpu = NULL;
 >  			return -ENOMEM;
 >  		}


Good eyes. Yes, looks correct to me.

		Dave

-- 
 Dave Jones     http://www.codemonkey.org.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-01 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-29 17:04 [PATCH] fix leak in btaudio davej
2003-10-01 18:31 ` Sander van Malssen
2003-10-01 18:35   ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).