Skip to content

Commit

Permalink
Staging: easycap: use after free in easycap_delete()
Browse files Browse the repository at this point in the history
The JOM() macro dereferences peasycap, so I moved the free down some
lines.

Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Tomas Winkler <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
error27 authored and gregkh committed Jul 5, 2011
1 parent 981aabb commit 38d0cff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/staging/easycap/easycap_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,6 @@ static void easycap_delete(struct kref *pkref)
allocation_audio_struct = peasycap->allocation_audio_struct;
registered_audio = peasycap->registered_audio;

kfree(peasycap);

if (0 <= kd && DONGLE_MANY > kd) {
if (mutex_lock_interruptible(&mutex_dongle)) {
SAY("ERROR: cannot down mutex_dongle\n");
Expand All @@ -929,6 +927,9 @@ static void easycap_delete(struct kref *pkref)
} else {
SAY("ERROR: cannot purge dongle[].peasycap");
}

kfree(peasycap);

/*---------------------------------------------------------------------------*/
SAY("%8i=video urbs after all deletions\n", allocation_video_urb);
SAY("%8i=video pages after all deletions\n", allocation_video_page);
Expand Down

0 comments on commit 38d0cff

Please sign in to comment.