Received: by 10.223.185.116 with SMTP id b49csp559390wrg; Tue, 20 Feb 2018 04:11:27 -0800 (PST) X-Google-Smtp-Source: AH8x226vNLHVe+hLrnWpNdBeeEyAIev5KXBokRncLt9j8xajWjrQJ24XlJnrAMTrz0QLKeitp5LH X-Received: by 10.101.90.10 with SMTP id y10mr13521949pgs.34.1519128686883; Tue, 20 Feb 2018 04:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519128686; cv=none; d=google.com; s=arc-20160816; b=QhVpqEhUkdh1pQrCBqizKsTDc9D/RIIsc+fJHBIGXKcU4t4S73yxZSjmbfv5HKHLo8 ndc+AV7q5LPt3d/ihp0QQpi0PKf1VgLnV2VZfewdfUPqvvrbod89iDTvE+pSLi5cYYnd l03tJdLJyYiMHYQrpejbcKZJMUEAmjJavD2ezkBQeHfb5BLpwsUfVrIg4oMtficc6rY+ cyuikvb0rT86oEWAfesH9WJ82y6+lPnrIMffwWi9JYRTla18Rsf7YpJBmGVmlbLaiwUN wIMkLYWQ4et9xXd6vpt6Phjb8ovo0awJNDF/15mrt+RTydIBTla/Ump5EndXMFd4pXDP iWdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=jAxc7KU8us48gb9aLunpzQsI/R1WSU6/vVLo28AZXsk=; b=WvVZqOIif0S1cTXxyJYqrd64DlUu3aXcM0UpEafFUdFIpsmpSiL0MbDtMl65oeiMww UHwxiEl8bx1TdfgXOGmnzIlIBU9g/JNuC95pOxL9Qt2BJ76yTWoYi8aIKrLHBDOimHyh XIyvawTKTDtM3SI8/DFqDW/AeWw9IK4OV8ZF9dbtr1qEZ+vWt3C34EBePTZsGB8zMxAk UbhkW0Kbioe7taQPjEwGvzJktu6LMY+enYScWYXqvAiREqM0E8i2GKcdZjOXRPXmHXPs jVuhBvnuyhsG5wMuvRtqZiEQXPoeOQayd5xoRGT/iY2b6LsxLgS3acAWc812VZnxgFo5 RGZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=ddaVXqmV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a31-v6si1677936pla.427.2018.02.20.04.11.12; Tue, 20 Feb 2018 04:11:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=ddaVXqmV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbeBTMKO (ORCPT + 99 others); Tue, 20 Feb 2018 07:10:14 -0500 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:33934 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751717AbeBTMKL (ORCPT ); Tue, 20 Feb 2018 07:10:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=jAxc7KU8us48gb9aLunpzQsI/R1WSU6/vVLo28AZXsk=; b=ddaVXqmVrk44 Vaces3JTkU7XLJ9yRsIoof9S5sJtqfGFHgKS5nuGRzxBzNKydQph8WOuHC7QRPSoNtlK9Uqr68BDI bWUaY+i2KN0q450evgb/8igGIn3Oba7uXnju4mEctPoN+ut7VqM/jiWGS5+JQcYAWtA9OWXHSYKqM 5Chi8=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1eo6kJ-0004wx-Vf; Tue, 20 Feb 2018 12:10:08 +0000 Received: from broonie by debutante with local (Exim 4.90_1) (envelope-from ) id 1eo6kJ-0003E2-GT; Tue, 20 Feb 2018 12:10:07 +0000 From: Mark Brown To: David Lechner Cc: Mark Brown , linux-kernel@vger.kernel.org, Mark Brown , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Applied "regmap: Allow missing device in regmap_name_read_file()" to the regmap tree In-Reply-To: <1519076582-7687-2-git-send-email-david@lechnology.com> Message-Id: Date: Tue, 20 Feb 2018 12:10:07 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regmap: Allow missing device in regmap_name_read_file() has been applied to the regmap tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git 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 From 12ae3808c160b7be0de3c633ac4cbe8c5f2937bf Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 19 Feb 2018 15:43:01 -0600 Subject: [PATCH] regmap: Allow missing device in regmap_name_read_file() This fixes a possible NULL pointer dereference oops in regmap_name_read_file() when the regmap does not have a device associated with it. For example syscon regmaps retrieved with syscon_regmap_lookup_by_compatible() don't have a device. Signed-off-by: David Lechner Signed-off-by: Mark Brown --- drivers/base/regmap/regmap-debugfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index f3266334063e..7eb512ba2828 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -40,6 +40,7 @@ static ssize_t regmap_name_read_file(struct file *file, loff_t *ppos) { struct regmap *map = file->private_data; + const char *name = "nodev"; int ret; char *buf; @@ -47,7 +48,10 @@ static ssize_t regmap_name_read_file(struct file *file, if (!buf) return -ENOMEM; - ret = snprintf(buf, PAGE_SIZE, "%s\n", map->dev->driver->name); + if (map->dev && map->dev->driver) + name = map->dev->driver->name; + + ret = snprintf(buf, PAGE_SIZE, "%s\n", name); if (ret < 0) { kfree(buf); return ret; -- 2.16.1