From patchwork Mon Apr 3 20:02:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13198678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07D9CC76196 for ; Mon, 3 Apr 2023 20:04:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 569BB6B0075; Mon, 3 Apr 2023 16:04:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 519686B0078; Mon, 3 Apr 2023 16:04:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E08B6B007B; Mon, 3 Apr 2023 16:04:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2F6BD6B0075 for ; Mon, 3 Apr 2023 16:04:15 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E3C6740C5B for ; Mon, 3 Apr 2023 20:04:14 +0000 (UTC) X-FDA: 80641156428.27.C0C0478 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id 23268C001F for ; Mon, 3 Apr 2023 20:04:12 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=nSauXv4t; spf=pass (imf10.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680552253; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=EibnDdO/xO6F0g89v1sw1NIYwJHNGRCBvQKgGzHpZqI=; b=5buEKJb6KcUPOpX5ExjOIW8AV+l/5QhcXCt1civ8qMjiLNUGa8CtzHpKxKJutEhLCf5cDd UEhbtclmGh9wCs078BqWP94OHLTEJE8nwqVt47xO1T48cWuGNiEzuD1n1aj8yFai1ShlAD pPiEfwLTU2OPQfIadLL6u32FuUDVscA= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=nSauXv4t; spf=pass (imf10.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680552253; a=rsa-sha256; cv=none; b=qjH9stt8iH8H5ZQuATFp7H946eB92V3M83IjA5eYx5X3D8C9x+pEtMdFGh+ZGrYW/3lPcW EciaZJuBVZYslvlU2F0r+M3DrFO/WmMOuE2oIAS8mfIQRtdP8K024EgDqJlyVwu28gCybq t7TVYTLvTcVutd6ZOZguXOgglQeZuyU= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4771761FE3; Mon, 3 Apr 2023 20:04:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1113C433EF; Mon, 3 Apr 2023 20:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680552251; bh=uKL7799fDYCIk1oIRYYxbDwmU1HnkOg8MZI/5uqJOcw=; h=From:Date:Subject:To:Cc:From; b=nSauXv4tR1sV566ZWCYZFpwkxijbPwswBYdm2hPi/HpRLgx0WLWYjB6Dft9NsZAvS yzWA1R0mIGML+grHJWqQctf+Y7x9sMJcY64ub6eysH2Z9BwjLrnl/FA+KEDuOS8som c/5VTkTHA5turHjoLZ64vs8Tf95BS1/+a05Op2yEbZYAyTbI+XX7cxdDkdOjPGd6xc 1H+Z4wyolUng8Vwb2CAEU9xmZ9qKJ26OOQiGt2BAexQhNcyT+u9wBQkWYte6L2at1g 4K8/dbGNeErHrcatsKFWLbvYVcNexz8BpO5ECiI2MT5LiU3yv9YO/2Pzc7bvT7OqMG iyZVrCNCAjYsQ== From: Mark Brown Date: Mon, 03 Apr 2023 21:02:39 +0100 Subject: [PATCH] regmap: Fix double unlock in the maple cache MIME-Version: 1.0 Message-Id: <20230403-regmap-maple-unlock-v1-1-89998991b16c@kernel.org> X-B4-Tracking: v=1; b=H4sIAN4wK2QC/x2NywqDQAxFf0WybmCqI1p/pXQR06hBnZEMfYD47 x27uItz4XB2SGIqCbpiB5O3Jo0hw/VSAE8URkF9ZobSlZXzrkKTcaUN8xbBV1giz3hriVrP7Ju hhmz2lAR7o8DT6X6izee9mQz6/cfuj+P4AaWAle58AAAA To: Liam.Howlett@Oracle.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-00303 X-Developer-Signature: v=1; a=openpgp-sha256; l=1308; i=broonie@kernel.org; h=from:subject:message-id; bh=uKL7799fDYCIk1oIRYYxbDwmU1HnkOg8MZI/5uqJOcw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBkKzE5rGUCZgJbyOewX95msrYoXSZ5YAHswnkVF8An tqHmm9OJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZCsxOQAKCRAk1otyXVSH0Bi9B/ wOc73skUgpb7dv93+EQLtllqEPZP9dRLr42t0weINyxyccdWmkVHOzv3RqU/NWFy/+H/eIqzDYs7OZ mpyfG9HQF7EqpBugq2CXzZUbYn2YzXeLs/HBcnt4fL00pYBX3nwYgq6p+h3dInwweEwpnnyFDqxdBV UPxkldRlm4aTceW8in79PLDgOVywS8NIe+X8XdcYpIprESQdMkwR834vqtKHg89EXLNAhN/OKoWqy2 YZ9IRIb+j3Hw2Xa703upoVTeXKf8XfFVKsF4Qy3t+AstBCR+MH2DqlH+ucMEa9oYLmfWLAZbQ4Wg5a Lv4y/+oDWl/xeWfTSq8ssdxbgzQCkA X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 23268C001F X-Stat-Signature: qh9rn8otrrs5unur6d5qi5yuh4hx5tmn X-HE-Tag: 1680552252-902426 X-HE-Meta: U2FsdGVkX1/PjcZV23XTrEnH6YJGT/8Ju2h++pLgiEddQgKvWml9ftaB9AH2OPPeyh2ftevof+fFf27xV1T482qpLGn+nG3tzK0hzs+pe5HQMpy10IXqj05Yzw8pwQG0pmKaRcXAU7rukIuO98y+I8ZW0jyBJnId9YZmqgW7MTR6SwVhUbP/tm5xs6teFGNVzZr/X+jExLd7vPKUAknBEpOFZ7BoIROd3dJZmG6NLGPZJxFZOj4fYzRAIWF3KsViNNML8pykIZZX18djsWKCK0MAXAAqrywq37T5mX1pKt6RWHdFUAhcd3hPNHD8/bDnYA91ehGDTuUuD/1dKQJh4gReZvta14Nd0YtrwhvWV6GCs49QXUKvdr3vfodLYMcVuXeT0g1eXHPljW5H6m0OPRoytZEToZmXxwQsaMYVp58DkUudqH2JPGC7CuYBvmwxochRj5NKoJfKHiKfuCPX/P3sjdcstASH3CZOF0+w19B8TIXBpm1mUfy9Q4BLoO8MvjLQjnYEAO6VB/2Q7TPMc8N97neRsAbW6tLmy6IPjN8L2bsiHZe3nC6qY2MgC7UIp06vneT4Gop3HR0KPYn6b8p53UiLoYoql1ffwPB/OX/IzGh5+guSdG7j6cm+gNaN9F3/hbcI6+KIzYZ4shdC1qzzh77wkYjNVD1ztn/GssWqNejjhwqRjmdUilNlEHRkYVAmJdLqL16Jn1zJaVGqaDJoyK06SCFom3S6F1m6I2Gm7AB8E5oG7g1qb4KIVEtXFm+DKuCY1Va7wSGojke6KM2RrSUtLYzzpRSKWnUt9saTsWxPmTJ1kVSdMauq20d6GjsxViFGiUxmCjajzCo8pfgcCIivF9sh75lSd2jmBFSUcSA1AB3yR9BSOgVPVNwXChFhEzXpXom0mnRNID2QokKp+0VuXJEV6ONnGlxEt5jQmp8fr4ry+A3IXBHkGB+2GuTSdNeK1ET7br1WM+P O21Oa1oA p5Eyzu/Ur1NXJViw+UtsiMtap4yDiarM22Y/JOZXPYwq0wECXAxAiWlbmBS9FgWJjOY5euuIqxT3tcMaNEIPX8NM0OmefdSl9SyyeDTg9IAlkvukfO9ky2JPc9880ABimd2BicwKJ4mQ4TIt9bqfjavRyxyGZ+b5EbAXnT8V5jckpLvl+MgBEvRT1k1Nl/KYbjsL/INh4pyvXdZvbE36QvLkPnG1xxNqIc7SLjrv00jvGx9ohhDw94Q+jIsqj1tPAViJy2slZE6SH5G7N91Xh5kRY/4HuaoEQ84LiZxR6QBzAmg303XKBx7cPcNWAUFAiiXDHWTY2MMeDg79bYcpuGAVL1keOCz6YgK2ocrg17SwReGao0tXHzD1lbtDCYDgFLlW2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Signed-off-by: Mark Brown --- drivers/base/regmap/regcache-maple.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- base-commit: f033c26de5a5734625d2dd1dc196745fae186f1b change-id: 20230403-regmap-maple-unlock-98aa84cc47f5 Best regards, 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);