• Wenwen Wang's avatar
    firestream: fix memory leaks · 8e360d7c
    Wenwen Wang authored
    [ Upstream commit fa865ba1 ]
    
    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: default avatarWenwen Wang <wenwen@cs.uga.edu>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    8e360d7c
firestream.c 54.2 KB