]> www.infradead.org Git - users/dwmw2/linux.git/commit
kernel/module: Fix mem leak in module_add_modinfo_attrs
authorYueHaibing <yuehaibing@huawei.com>
Tue, 11 Jun 2019 15:00:07 +0000 (23:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Sep 2019 06:20:46 +0000 (08:20 +0200)
commit5b53e102b9757b2f079d42f38e2c6a355ef380a7
treeb7ac91b622c6936803a9e006b0d6407044c7f4da
parent2eff0ac931699b8d6b5eff7779da6ccad83812eb
kernel/module: Fix mem leak in module_add_modinfo_attrs

[ Upstream commit bc6f2a757d525e001268c3658bd88822e768f8db ]

In module_add_modinfo_attrs if sysfs_create_file
fails, we forget to free allocated modinfo_attrs
and roll back the sysfs files.

Fixes: 03e88ae1b13d ("[PATCH] fix module sysfs files reference counting")
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/module.c