Skip to content

Commit

Permalink
V4L/DVB (12369): stv680: kfree called before usb_kill_urb
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and Mauro Carvalho Chehab committed Sep 12, 2009
1 parent f5d887a commit 085575a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/media/video/stv680.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,17 +734,18 @@ 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]);
stv680->urb[i] = NULL;
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;

}
Expand Down

0 comments on commit 085575a

Please sign in to comment.