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>] [day] [month] [year] [list]
Message-Id: <1548293716-41608-1-git-send-email-wen.yang99@zte.com.cn>
Date:   Thu, 24 Jan 2019 09:35:16 +0800
From:   Wen Yang <wen.yang99@....com.cn>
To:     arnd@...db.de
Cc:     gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        xue.zhihong@....com.cn, wang.yi59@....com.cn,
        Wen Yang <wen.yang99@....com.cn>,
        "David S. Miller" <davem@...emloft.net>
Subject: [RESEND PATCH] char/rtc: fix object reference leaks in rtc_init

The device node iterators perform an of_node_get on each iteration, so a
jump out of the loop requires an of_node_put.
The of_find_device_by_node() takes a reference to the underlying device
structure, we also should release that reference.
This patch fixes those 2 issues.
Fixes: 75081322c ("sparc32: Convert PC RTC probing to pure OF driver")

Signed-off-by: Wen Yang <wen.yang99@....com.cn>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: David S. Miller <davem@...emloft.net>
Cc: linux-kernel@...r.kernel.org
---
 drivers/char/rtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index c862d0b..aa67690 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -872,6 +872,8 @@ static int __init rtc_init(void)
 				if (op) {
 					rtc_port = op->resource[0].start;
 					rtc_irq = op->irqs[0];
+					put_device(&op->dev);
+					of_node_put(dp);
 					goto found;
 				}
 			}
-- 
2.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ