Commit 38d0cffe authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

Staging: easycap: use after free in easycap_delete()

The JOM() macro dereferences peasycap, so I moved the free down some
lines.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 981aabb1
...@@ -913,8 +913,6 @@ static void easycap_delete(struct kref *pkref) ...@@ -913,8 +913,6 @@ static void easycap_delete(struct kref *pkref)
allocation_audio_struct = peasycap->allocation_audio_struct; allocation_audio_struct = peasycap->allocation_audio_struct;
registered_audio = peasycap->registered_audio; registered_audio = peasycap->registered_audio;
kfree(peasycap);
if (0 <= kd && DONGLE_MANY > kd) { if (0 <= kd && DONGLE_MANY > kd) {
if (mutex_lock_interruptible(&mutex_dongle)) { if (mutex_lock_interruptible(&mutex_dongle)) {
SAY("ERROR: cannot down mutex_dongle\n"); SAY("ERROR: cannot down mutex_dongle\n");
...@@ -929,6 +927,9 @@ static void easycap_delete(struct kref *pkref) ...@@ -929,6 +927,9 @@ static void easycap_delete(struct kref *pkref)
} else { } else {
SAY("ERROR: cannot purge dongle[].peasycap"); SAY("ERROR: cannot purge dongle[].peasycap");
} }
kfree(peasycap);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
SAY("%8i=video urbs after all deletions\n", allocation_video_urb); SAY("%8i=video urbs after all deletions\n", allocation_video_urb);
SAY("%8i=video pages after all deletions\n", allocation_video_page); SAY("%8i=video pages after all deletions\n", allocation_video_page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment