diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-11-15 06:16:38 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-20 16:22:53 +0300 |
commit | e5da06b27ff5a148e42265c8e306670a9d913969 (patch) | |
tree | b83c3190311d7f4fe0731fcdef3f2803cbd11815 /drivers/gpu/drm/msm/hdmi | |
parent | a86367803838b369fe5486ac18771d14723c258c (diff) | |
download | linux-e5da06b27ff5a148e42265c8e306670a9d913969.tar.xz |
drivers: base: transport_class: fix resource leak when transport_add_device() fails
The normal call sequence of using transport class is:
Add path:
transport_setup_device()
transport_setup_classdev() // call sas_host_setup() here
transport_add_device() // if fails, need call transport_destroy_device()
transport_configure_device()
Remove path:
transport_remove_device()
transport_remove_classdev // call sas_host_remove() here
transport_destroy_device()
If transport_add_device() fails, need call transport_destroy_device()
to free memory, but in this case, ->remove() is not called, and the
resources allocated in ->setup() are leaked. So fix these leaks by
calling ->remove() in transport_add_class_device() if it returns error.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221115031638.3816551-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpu/drm/msm/hdmi')
0 files changed, 0 insertions, 0 deletions