]> git.baikalelectronics.ru Git - kernel.git/commit
firestream: fix memory leaks
authorWenwen Wang <wenwen@cs.uga.edu>
Sat, 25 Jan 2020 14:33:29 +0000 (14:33 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Jan 2020 21:01:51 +0000 (22:01 +0100)
commit1411ded72315b5d14f3f3fd66d4ebd88a8feee2c
tree4be17674bd260e025ac2bff006fbc98afdbb5a5b
parent32aedd962a132468e094b76070c7b26b2c9e831e
firestream: fix memory leaks

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>
drivers/atm/firestream.c