diff options
author | Robert Krakora <rob.krakora@messagenetsystems.com> | 2009-01-16 09:23:25 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-01-29 05:38:43 -0500 |
commit | 53d12e5a56934c31ca59f3b6f127e5a68e645fd2 (patch) | |
tree | 00d0cbf7ac06e3a986b9478dbac72a86b8f88b80 /drivers/media/video/em28xx | |
parent | ba390f005573bdf6ab7fd78bb05119036c2ed539 (diff) |
V4L/DVB (10254): em28xx: Fix audio URB transfer buffer race condition
em28xx: Fix audio URB transfer buffer memory leak and race
condition/corruption of capture pointer
Leak fix kindly contributed by Pádraig Brady.
Signed-off-by: Robert Krakora <rob.krakora@messagenetsystems.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-audio.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 94378ccb7505..4df6d3288424 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c | |||
@@ -65,6 +65,9 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev) | |||
65 | usb_unlink_urb(dev->adev.urb[i]); | 65 | usb_unlink_urb(dev->adev.urb[i]); |
66 | usb_free_urb(dev->adev.urb[i]); | 66 | usb_free_urb(dev->adev.urb[i]); |
67 | dev->adev.urb[i] = NULL; | 67 | dev->adev.urb[i] = NULL; |
68 | |||
69 | kfree(dev->adev.transfer_buffer[i]); | ||
70 | dev->adev.transfer_buffer[i] = NULL; | ||
68 | } | 71 | } |
69 | 72 | ||
70 | return 0; | 73 | return 0; |
@@ -389,11 +392,15 @@ static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, | |||
389 | static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream | 392 | static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream |
390 | *substream) | 393 | *substream) |
391 | { | 394 | { |
392 | struct em28xx *dev; | 395 | unsigned long flags; |
393 | 396 | ||
397 | struct em28xx *dev; | ||
394 | snd_pcm_uframes_t hwptr_done; | 398 | snd_pcm_uframes_t hwptr_done; |
399 | |||
395 | dev = snd_pcm_substream_chip(substream); | 400 | dev = snd_pcm_substream_chip(substream); |
401 | spin_lock_irqsave(&dev->adev.slock, flags); | ||
396 | hwptr_done = dev->adev.hwptr_done_capture; | 402 | hwptr_done = dev->adev.hwptr_done_capture; |
403 | spin_unlock_irqrestore(&dev->adev.slock, flags); | ||
397 | 404 | ||
398 | return hwptr_done; | 405 | return hwptr_done; |
399 | } | 406 | } |