Skip to content
Snippets Groups Projects
Commit ee2715fa authored by ruanjinjie's avatar ruanjinjie Committed by Greg Kroah-Hartman
Browse files

misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()


[ Upstream commit fd2c930c ]

If device_register() returns error in tifm_7xx1_switch_media(),
name of kobject which is allocated in dev_set_name() called in device_add()
is leaked.

Never directly free @dev after calling device_register(), even
if it returned an error! Always use put_device() to give up the
reference initialized.

Fixes: 2428a8fe ("tifm: move common device management tasks from tifm_7xx1 to tifm_core")
Signed-off-by: default avatarruanjinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20221117064725.3478402-1-ruanjinjie@huawei.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0cd05062
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment