lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1536133287-21110-1-git-send-email-dingxiang@cmss.chinamobile.com>
Date:   Wed,  5 Sep 2018 15:41:27 +0800
From:   Ding Xiang <dingxiang@...s.chinamobile.com>
To:     ralf@...ux-mips.org, paul.burton@...s.com, jhogan@...nel.org,
        linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org
Cc:     dingxiang@...s.chinamobile.com
Subject: [PATCH] mips: txx9: fix resource leak after register fail

the memory allocated and ioremap address need free after
device_register return error.

Signed-off-by: Ding Xiang <dingxiang@...s.chinamobile.com>
---
 arch/mips/txx9/generic/setup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index f6d9182..7f4fd2b 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -961,11 +961,13 @@ void __init txx9_sramc_init(struct resource *r)
 	err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr);
 	if (err) {
 		device_unregister(&dev->dev);
-		iounmap(dev->base);
-		kfree(dev);
+		goto exit_free;
 	}
 	return;
 exit_put:
 	put_device(&dev->dev);
+exit_free:
+	iounmap(dev->base);
+	kfree(dev);
 	return;
 }
-- 
1.9.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ