Message ID | 20231006082104.16707-1-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp165849vqo; Fri, 6 Oct 2023 01:22:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9abXGHsOzhaCpF5xqGkLUw9GRtMarghb/Bt5cFW7hmROgyXVZxXHWkUuUiquQ9c+ZSmrA X-Received: by 2002:a05:6a20:3c8c:b0:169:3769:2776 with SMTP id b12-20020a056a203c8c00b0016937692776mr6580992pzj.37.1696580553686; Fri, 06 Oct 2023 01:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696580553; cv=none; d=google.com; s=arc-20160816; b=uIGGaUZvaEIOQgBC3PenMEFeB6gZmxzZnGFlcu0pw3pezF/B9y2W0pAacRLrKcBEro Gra6Xzgm5uvVlLCLmMpwNqmjVJ17tiy6JcCyxQg+KkDf714/zB68Bwb2MTU8k1VkvCQC Kmb4ef6RnAI5awi/GK1jckPFTseckKr2spqTEFzPXAKaYwM5TDcMXjFebYUlS1G6sb06 wvHOjwGqCM+ZaI/pBS6m5Sxs05VhK5wpqOLqeowEWtb17Zw5yGXm/KkxV+X9ty4JpTOf /1gE1k7FA9QKxkcyJcCOxmQ9ua3PoiZCD+wacskkYIe8bJkfkWODRnJFz9KZ0TSDmP7V yO+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Jxlpdz9tYbo+MYnuymydUJH0APPX24YNdQskN8Ew/rc=; fh=1Adqbw/eukceA0oOn1ahLpR52W1CLGC/THJYoPneshE=; b=RcN7mBsiUoANx4tiWp+lZVok+gOmIyn8ubIwO8jQd8pqabfO7dx2MqXlaxve6mJSVa EdFsXoVooWxSwTdSHnw7bhpGVUN7JhgKMzA9gYDKFBtpC9Eekcl5MM4wpzfRzy01hpvj B0KI37TaR4CwZT40Y+orWHGf37yLS6gk4P6YfDu9Twrrc76Mzvu/S18MzlPh5fmrgn1U Aqw8XTNKby3CnFBvn3KuHD0MhiAZl5BNVQ5/lQbxV4h4kETFsJUVRdNoJQKJofj7pwM8 YIfVOGlSbG+ffLGixOr/N3tSOCSJm/lXwQ1ZzkyRKUz6bKM6nSVv/9gAbEPLUNEUzjEw Z4DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="br3bgF/3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ca8-20020a056a00418800b0069d1639f09esi277222pfb.190.2023.10.06.01.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 01:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="br3bgF/3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 0CFE78182EC6; Fri, 6 Oct 2023 01:22:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230509AbjJFIVy (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Fri, 6 Oct 2023 04:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbjJFIVv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Oct 2023 04:21:51 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B801E9; Fri, 6 Oct 2023 01:21:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBEBFC433C7; Fri, 6 Oct 2023 08:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696580509; bh=Rleyk+ijWu/nDpxQgC3SNjU9qlvK6Ft6iDjWmhbKDIY=; h=From:To:Cc:Subject:Date:From; b=br3bgF/3/cRbaRJkBy3sRCjuWMUfnImgEykeBlfA8FIxEy2wPP8oSIi8IElBxVS/F BybGhOPmrxEKJfWzLGitiqFsXcVfNxxuCMctgyKZ7DWbYjSweS1CDFznttr1R/O7ED mrdpUTgGvPM4k+VaVLycb8ZeScw/wikpXbRP9poFuj954GaWiXiGGrMhY5kxxBPsYJ aW7NL9cpr4CGsLsRT1G91GUrR0SSRkvTR8zZTCBG+k7Cufy5hhijjW7eDsEIuOJhgF iFWyt8b+ta9VFf/OO1aKci9OBm/hgAaHgJo7VSpIfceLuTTgltILJ2CkcyANzlIUKZ v71a5H2bfqo3Q== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from <johan+linaro@kernel.org>) id 1qog63-0004M8-2O; Fri, 06 Oct 2023 10:22:08 +0200 From: Johan Hovold <johan+linaro@kernel.org> To: Mark Brown <broonie@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org>, stable@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de> Subject: [PATCH] regmap: fix NULL deref on lookup Date: Fri, 6 Oct 2023 10:21:04 +0200 Message-ID: <20231006082104.16707-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 06 Oct 2023 01:22:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778993650463519053 X-GMAIL-MSGID: 1778993650463519053 |
Series |
regmap: fix NULL deref on lookup
|
|
Commit Message
Johan Hovold
Oct. 6, 2023, 8:21 a.m. UTC
Not all regmaps have a name so make sure to check for that to avoid
dereferencing a NULL pointer when dev_get_regmap() is used to lookup a
named regmap.
Fixes: e84861fec32d ("regmap: dev_get_regmap_match(): fix string comparison")
Cc: stable@vger.kernel.org # 5.8
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/base/regmap/regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Fri, 06 Oct 2023 10:21:04 +0200, Johan Hovold wrote: > Not all regmaps have a name so make sure to check for that to avoid > dereferencing a NULL pointer when dev_get_regmap() is used to lookup a > named regmap. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next Thanks! [1/1] regmap: fix NULL deref on lookup commit: c6df843348d6b71ea986266c12831cb60c2cf325 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 884cb51c8f67..234a84ecde8b 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1478,7 +1478,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data) /* If the user didn't specify a name match any */ if (data) - return !strcmp((*r)->name, data); + return (*r)->name && !strcmp((*r)->name, data); else return 1; }