linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Liam.Howlett@Oracle.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Mark Brown <broonie@kernel.org>
Subject: [PATCH] regmap: Fix double unlock in the maple cache
Date: Mon, 03 Apr 2023 21:02:39 +0100	[thread overview]
Message-ID: <20230403-regmap-maple-unlock-v1-1-89998991b16c@kernel.org> (raw)

Doing the dance to drop the maple tree's internal spinlock means we need
multiple exit paths in our error handling.

Reported-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/base/regmap/regcache-maple.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regcache-maple.c b/drivers/base/regmap/regcache-maple.c
index 497cc708d277..20fb7228fc6b 100644
--- a/drivers/base/regmap/regcache-maple.c
+++ b/drivers/base/regmap/regcache-maple.c
@@ -137,7 +137,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
 					GFP_KERNEL);
 			if (!lower) {
 				ret = -ENOMEM;
-				goto out;
+				goto out_unlocked;
 			}
 		}
 
@@ -151,7 +151,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
 					GFP_KERNEL);
 			if (!upper) {
 				ret = -ENOMEM;
-				goto out;
+				goto out_unlocked;
 			}
 		}
 
@@ -179,6 +179,7 @@ static int regcache_maple_drop(struct regmap *map, unsigned int min,
 
 out:
 	mas_unlock(&mas);
+out_unlocked:
 	kfree(lower);
 	kfree(upper);
 

---
base-commit: f033c26de5a5734625d2dd1dc196745fae186f1b
change-id: 20230403-regmap-maple-unlock-98aa84cc47f5

Best regards,
-- 
Mark Brown <broonie@kernel.org>



             reply	other threads:[~2023-04-03 20:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 20:02 Mark Brown [this message]
2023-04-04 14:43 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230403-regmap-maple-unlock-v1-1-89998991b16c@kernel.org \
    --to=broonie@kernel.org \
    --cc=Liam.Howlett@Oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox