summaryrefslogtreecommitdiffstats
path: root/drivers/char/hpet.c
diff options
context:
space:
mode:
authorAtul Gopinathan <atulgopinathan@gmail.com>2021-05-03 13:56:54 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-13 17:33:32 +0200
commitd03d1021da6fe7f46efe9f2a7335564e7c9db5ab (patch)
tree1f1dbf1c869263ffb0f4f344971f3c269922eeea /drivers/char/hpet.c
parent257343d3ed557f11d580d0b7c515dc154f64a42b (diff)
downloadlinux-d03d1021da6fe7f46efe9f2a7335564e7c9db5ab.tar.bz2
cdrom: gdrom: deallocate struct gdrom_unit fields in remove_gdrom
The fields, "toc" and "cd_info", of "struct gdrom_unit gd" are allocated in "probe_gdrom()". Prevent a memory leak by making sure "gd.cd_info" is deallocated in the "remove_gdrom()" function. Also prevent double free of the field "gd.toc" by moving it from the module's exit function to "remove_gdrom()". This is because, in "probe_gdrom()", the function makes sure to deallocate "gd.toc" in case of any errors, so the exit function invoked later would again free "gd.toc". The patch also maintains consistency by deallocating the above mentioned fields in "remove_gdrom()" along with another memory allocated field "gd.disk". Suggested-by: Jens Axboe <axboe@kernel.dk> Cc: Peter Rosin <peda@axentia.se> Cc: stable <stable@vger.kernel.org> Signed-off-by: Atul Gopinathan <atulgopinathan@gmail.com> Link: https://lore.kernel.org/r/20210503115736.2104747-28-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/hpet.c')
0 files changed, 0 insertions, 0 deletions