public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.27.8 1/1] em28xx: Fix audio URB transfer buffer memory leak and race condition/corruption of capture pointer
@ 2009-01-14 18:04 Robert Krakora
  2009-01-14 18:31 ` Robert Krakora
  2009-01-15 11:06 ` [PATCH 2.6.27.8 1/1] " Pádraig Brady
  0 siblings, 2 replies; 14+ messages in thread
From: Robert Krakora @ 2009-01-14 18:04 UTC (permalink / raw)
  To: video4linux-list

em28xx: Fix audio URB transfer buffer memory leak and race
condition/corruption of capture pointer

Developer's Certificate of Origin 1.1

        By making a contribution to this project, I certify that:

        (a) The contribution was created in whole or in part by me and I
            have the right to submit it under the open source license
            indicated in the file; or

        (b) The contribution is based upon previous work that, to the best
            of my knowledge, is covered under an appropriate open source
            license and I have the right under that license to submit that
            work with modifications, whether created in whole or in part
            by me, under the same open source license (unless I am
            permitted to submit under a different license), as indicated
            in the file; or

        (c) The contribution was provided directly to me by some other
            person who certified (a), (b) or (c) and I have not modified
            it.

        (d) I understand and agree that this project and the contribution
            are public and that a record of the contribution (including all
            personal information I submit with it, including my sign-off) is
            maintained indefinitely and may be redistributed consistent with
            this project or the open source license(s) involved.

Signed-off-by: Robert V. Krakora <rob.krakora@messagenetsystems.com>

diff -r 6896782d783d linux/drivers/media/video/em28xx/em28xx-audio.c
--- a/linux/drivers/media/video/em28xx/em28xx-audio.c   Wed Jan 14
10:06:12 2009 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-audio.c   Wed Jan 14
12:47:00 2009 -0500
@@ -62,11 +62,20 @@
        int i;

        dprintk("Stopping isoc\n");
-       for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
-               usb_unlink_urb(dev->adev.urb[i]);
-               usb_free_urb(dev->adev.urb[i]);
-               dev->adev.urb[i] = NULL;
-       }
+        for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
+               usb_unlink_urb(dev->adev.urb[i]);
+               usb_free_urb(dev->adev.urb[i]);
+               dev->adev.urb[i] = NULL;
+               if (dev->adev.urb[i]) {
+                       usb_unlink_urb(dev->adev.urb[i]);
+                       usb_free_urb(dev->adev.urb[i]);
+                       dev->adev.urb[i] = NULL;
+               }
+                if (dev->adev.transfer_buffer) {
+                       kfree(dev->adev.transfer_buffer[i]);
+                       dev->adev.transfer_buffer[i] = NULL;
+               }
+        }

        return 0;
 }
@@ -458,11 +467,15 @@
                                                    *substream)
 #endif
 {
+       unsigned long flags;
+
        struct em28xx *dev;
-
        snd_pcm_uframes_t hwptr_done;
+
        dev = snd_pcm_substream_chip(substream);
+       spin_lock_irqsave(&dev->adev.slock, flags);
        hwptr_done = dev->adev.hwptr_done_capture;
+       spin_unlock_irqrestore(&dev->adev.slock, flags);

        return hwptr_done;
 }

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

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

end of thread, other threads:[~2009-01-16 14:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 18:04 [PATCH 2.6.27.8 1/1] em28xx: Fix audio URB transfer buffer memory leak and race condition/corruption of capture pointer Robert Krakora
2009-01-14 18:31 ` Robert Krakora
2009-01-14 18:44   ` Robert Krakora
2009-01-14 18:55     ` [PATCH 1/4] " Robert Krakora
2009-01-14 20:02       ` Fwd: " Robert Krakora
2009-01-14 20:08         ` Robert Krakora
2009-01-15 22:31         ` Robert Krakora
2009-01-16 14:23           ` Robert Krakora
2009-01-15 11:06 ` [PATCH 2.6.27.8 1/1] " Pádraig Brady
2009-01-15 11:27   ` Markus Rechberger
2009-01-15 14:49     ` Robert Krakora
2009-01-15 14:32   ` Robert Krakora
2009-01-15 14:58     ` Pádraig Brady
2009-01-15 15:32       ` Robert Krakora

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox