Skip to content

Commit

Permalink
drivers/video/uvesafb.c: fix error-path memory leak
Browse files Browse the repository at this point in the history
Fix bug identified by Daniel Marjamki: `m' is leaked on the error path.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=10452

Cc: Daniel Marjamki <danielm77@spray.se>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Apr 28, 2008
1 parent 0e27aa3 commit 60c1645
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/video/uvesafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ static int uvesafb_exec(struct uvesafb_ktask *task)
/* If all slots are taken -- bail out. */
if (uvfb_tasks[seq]) {
mutex_unlock(&uvfb_lock);
return -EBUSY;
err = -EBUSY;
goto out;
}

/* Save a pointer to the kernel part of the task struct. */
Expand All @@ -205,7 +206,6 @@ static int uvesafb_exec(struct uvesafb_ktask *task)
err = cn_netlink_send(m, 0, gfp_any());
}
}
kfree(m);

if (!err && !(task->t.flags & TF_EXIT))
err = !wait_for_completion_timeout(task->done,
Expand All @@ -218,7 +218,8 @@ static int uvesafb_exec(struct uvesafb_ktask *task)
seq++;
if (seq >= UVESAFB_TASKS_MAX)
seq = 0;

out:
kfree(m);
return err;
}

Expand Down

0 comments on commit 60c1645

Please sign in to comment.