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  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]
Date:   Thu,  9 Aug 2018 01:13:07 +0300
From:   Alexey Khoroshilov <khoroshilov@...ras.ru>
To:     Denis Osterland <Denis.Osterland@...hl.com>,
        Michael Grzeschik <m.grzeschik@...gutronix.de>,
        Alessandro Zummo <a.zummo@...ertech.it>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc:     Alexey Khoroshilov <khoroshilov@...ras.ru>,
        linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org,
        ldv-project@...uxtesting.org
Subject: [PATCH] rtc: isl1208: fix error handling in isl1208_probe()

After moving rtc_register_device() sysfs group is left unremoved
on the error path.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
Fixes: 236b7187034e ("rtc: isl1208: switch to rtc_register_device")
---
 drivers/rtc/rtc-isl1208.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 1a2c38cc0178..4b5df9bfb8d4 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -674,7 +674,12 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		}
 	}
 
-	return rtc_register_device(rtc);
+	rc = rtc_register_device(rtc);
+	if (rc) {
+		sysfs_remove_group(&client->dev.kobj, &isl1208_rtc_sysfs_files);
+		return rc;
+	}
+	return 0;
 }
 
 static int
-- 
2.7.4

Powered by blists - more mailing lists