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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210405154221.GB305@amd>
Date:   Mon, 5 Apr 2021 17:42:21 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Jonathan Hunter <jonathanh@...dia.com>,
        Thierry Reding <treding@...dia.com>
Subject: Re: [PATCH 5.10 079/126] drm/tegra: sor: Grab runtime PM reference
 across reset

Hi!

> However, these functions alone don't provide any guarantees at the
> system level. Drivers need to ensure that the only a single consumer has
> access to the reset at the same time. In order for the SOR to be able to
> exclusively access its reset, it must therefore ensure that the SOR
> power domain is not powered off by holding on to a runtime PM reference
> to that power domain across the reset assert/deassert operation.

Yeah, but it should not leak the PM reference in the error handling.

Signed-off-by: Pavel Machek (CIP) <pavel@...x.de>

Best regards,
								Pavel

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 7b88261f57bb..b3b727b2a3c5 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -3125,21 +3125,21 @@ static int tegra_sor_init(struct host1x_client *client)
 		if (err < 0) {
 			dev_err(sor->dev, "failed to acquire SOR reset: %d\n",
 				err);
-			return err;
+			goto maybe_put;
 		}
 
 		err = reset_control_assert(sor->rst);
 		if (err < 0) {
 			dev_err(sor->dev, "failed to assert SOR reset: %d\n",
 				err);
-			return err;
+			goto maybe_put;
 		}
 	}
 
 	err = clk_prepare_enable(sor->clk);
 	if (err < 0) {
 		dev_err(sor->dev, "failed to enable clock: %d\n", err);
-		return err;
+		goto maybe_put;
 	}
 
 	usleep_range(1000, 3000);
@@ -3150,7 +3150,7 @@ static int tegra_sor_init(struct host1x_client *client)
 			dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
 				err);
 			clk_disable_unprepare(sor->clk);
-			return err;
+			goto maybe_put;
 		}
 
 		reset_control_release(sor->rst);
@@ -3171,6 +3171,11 @@ static int tegra_sor_init(struct host1x_client *client)
 	}
 
 	return 0;
+
+ maybe_put:
+	if (sor->rst)
+		pm_runtime_put(sor->dev);
+	return err;
 }
 
 static int tegra_sor_exit(struct host1x_client *client)


-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ