aboutsummaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2009-07-28 11:52:10 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 12:18:28 -0300
commit085575a325de87b4931a43c9d0a75ca0d3ba5075 (patch)
tree9cc12091b7856d6cf3db50f01f4b6c5de3550c8e /drivers/media
parentf5d887ae60ea1b05fcdab65e51e1ef88398ed274 (diff)
V4L/DVB (12369): stv680: kfree called before usb_kill_urb
The irq handler will touch memory. Even in the error case some URBs may complete. Thus no memory must be kfreed before all URBs are killed. Signed-off-by: Oliver Neukum <oliver@neukum.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/stv680.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c
index 8b4e7dafce7..6a91714125d 100644
--- a/drivers/media/video/stv680.c
+++ b/drivers/media/video/stv680.c
@@ -734,10 +734,6 @@ static int stv680_start_stream (struct usb_stv *stv680)
return 0;
nomem_err:
- for (i = 0; i < STV680_NUMSCRATCH; i++) {
- kfree(stv680->scratch[i].data);
- stv680->scratch[i].data = NULL;
- }
for (i = 0; i < STV680_NUMSBUF; i++) {
usb_kill_urb(stv680->urb[i]);
usb_free_urb(stv680->urb[i]);
@@ -745,6 +741,11 @@ static int stv680_start_stream (struct usb_stv *stv680)
kfree(stv680->sbuf[i].data);
stv680->sbuf[i].data = NULL;
}
+ /* used in irq, free only as all URBs are dead */
+ for (i = 0; i < STV680_NUMSCRATCH; i++) {
+ kfree(stv680->scratch[i].data);
+ stv680->scratch[i].data = NULL;
+ }
return -ENOMEM;
}