]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
firestream: fix memory leaks
authorWenwen Wang <wenwen@cs.uga.edu>
Sat, 25 Jan 2020 14:33:29 +0000 (14:33 +0000)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 6 Mar 2020 07:13:20 +0000 (02:13 -0500)
commitced5efe94849bcd3b2cafed92af50d426362f306
treec3284779338663422f9f231ef1f53081596d7713
parenta78d21bd8bb58c158f73108eb7d7402619fcae3d
firestream: fix memory leaks

BugLink: https://bugs.launchpad.net/bugs/1864261
[ Upstream commit fa865ba183d61c1ec8cbcab8573159c3b72b89a4 ]

In fs_open(), 'vcc' is allocated through kmalloc() and assigned to
'atm_vcc->dev_data.' In the following execution, if an error occurs, e.g.,
there is no more free channel, an error code EBUSY or ENOMEM will be
returned. However, 'vcc' is not deallocated, leading to memory leaks. Note
that, in normal cases where fs_open() returns 0, 'vcc' will be deallocated
in fs_close(). But, if fs_open() fails, there is no guarantee that
fs_close() will be invoked.

To fix this issue, deallocate 'vcc' before the error code is returned.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/atm/firestream.c