summaryrefslogtreecommitdiff
path: root/ipc/shm.c
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-09-19 19:37:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-07 08:27:24 -0700
commit8455d77c2b1a558aacef5c61c2d2b73dc8237c8b (patch)
tree838f12d4df51111783d07ba87a1ee5e156e9df6c /ipc/shm.c
parent03acba6021da7f7bde0c0886379873791c6e24bf (diff)
staging: comedi: fix memory leak for saved channel list
commit c8cad4c89ee3b15935c532210ae6ebb5c0a2734d upstream. When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel list, it frees any previously allocated channel list in `async->cmd.chanlist` and replaces it with the new one. However, if the device is ever removed (or "detached") the cleanup code in `cleanup_device()` in "drivers.c" does not free this memory so it is lost. A sensible place to free the kernel copy of the channel list is in `do_become_nonbusy()` as at that point the comedi asynchronous command associated with the channel list is no longer valid. Free the channel list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the pointer to prevent it being freed more than once. Note that `cleanup_device()` could be called at an inappropriate time while the comedi device is open, but that's a separate bug not related to this this patch. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'ipc/shm.c')
0 files changed, 0 insertions, 0 deletions