Skip to content

Commit

Permalink
Input: mousedev - fix memory leak
Browse files Browse the repository at this point in the history
Apparently, "while true; do cat </dev/null >/dev/input/mice; done" causes
an OOM in a short amount of time. Funny that nobody noticed, it actually
is very easy to trigger just by switching between VT1 and VT7...

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Kimball Murray authored and Dmitry Torokhov committed Jan 30, 2006
1 parent 5ae08f8 commit 74570d4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/input/mousedev.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ static void mousedev_free(struct mousedev *mousedev)
kfree(mousedev);
}

static int mixdev_release(void)
static void mixdev_release(void)
{
struct input_handle *handle;

Expand All @@ -370,8 +370,6 @@ static int mixdev_release(void)
mousedev_free(mousedev);
}
}

return 0;
}

static int mousedev_release(struct inode * inode, struct file * file)
Expand All @@ -384,9 +382,8 @@ static int mousedev_release(struct inode * inode, struct file * file)

if (!--list->mousedev->open) {
if (list->mousedev->minor == MOUSEDEV_MIX)
return mixdev_release();

if (!mousedev_mix.open) {
mixdev_release();
else if (!mousedev_mix.open) {
if (list->mousedev->exist)
input_close_device(&list->mousedev->handle);
else
Expand Down

0 comments on commit 74570d4

Please sign in to comment.