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]
Date:	Wed, 12 Dec 2012 22:24:57 +0200
From:	Ido Yariv <ido@...ery.com>
To:	Ohad Ben-Cohen <ohad@...ery.com>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-omap@...r.kernel.org
Cc:	Ido Yariv <ido@...ery.com>
Subject: [PATCH] hwspinlock/core: Fix unbalanced module_get on error path

In case pm_runtime_get_sync() fails, __hwspin_lock_request will exit
without calling module_put. As a result, the module could never be
removed. Fix this.

Signed-off-by: Ido Yariv <ido@...ery.com>
---
 drivers/hwspinlock/hwspinlock_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index db713c0..085e28e 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -415,6 +415,7 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock)
 	/* notify PM core that power is now needed */
 	ret = pm_runtime_get_sync(dev);
 	if (ret < 0) {
+		module_put(dev->driver->owner);
 		dev_err(dev, "%s: can't power on device\n", __func__);
 		return ret;
 	}
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ