From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227leG6FCUJDJ5ImLpVHNaFFWaLqq+LLUh/Hx51tWOgD//PGEcEDAs3HQ8eCJ3sXIZaLWkN9 ARC-Seal: i=1; a=rsa-sha256; t=1516809887; cv=none; d=google.com; s=arc-20160816; b=a5Qyz/y+6tnaCXu1Cqx6lxFMh9FjBwcogfNx54X51018yNW4hjZREwgiT7ZdBof1mL X+HbC+ZzvPf5et0jnikufFXcJONl1woI6KDZBkBkKZQ4uhi5uzWEpPXPNZHV3HUKTI69 Fyt4AYe0InRw5394DQKkuOhWuoc8z++wKh/SeLbfoEGLrDYy39+dXfdS4PN/qUVERYDe vAfoTkXBl69NlajoG3Qfe5GKJfasWxdO/jMnQFjsOeW7ysxKw9NoQY3aFmz0CWUjmQNL bEj/I5bULawHMmhgYfUGfX+zFw7Ox2yvHWNIvMusAHa05kckaRH81Oxqow1bJ1u9LSMB ae2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=kCG7e+DWR2NdC9589OWxaaLldltc/YrOMPrUOhq6h70=; b=H/hkuJ7ifMTAffACP84YBuiZpKeQltYN0zgIWdmb/ac/MmLlwGb/k8H1Ag6haSwIgO npGBZs+Id3I73QkjlIwC7YuCAXIJkh7q1yXGzQKyrE23TPfuLiV4JpGzIaaNUbAe0OLP TeZodnfvR9eEEx4MP5OSt1CV5xRXOVrwZYi+dNDU/NDd0AYfZIzeG3gNg2XQfYMYkIu8 z0afPUuyTsKHvhmjWDWGLcbzUHMqZJUTBdphSk0U8Bq0+pvgNTuMvpGeWvx81VioiyN1 k01A8N9IXlra+M3Q2FI/UB7vSV5AlDUnjk/qzg3eHl57Z78eOpo0sYy3BVGjG/Pr96y2 4iOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lechnology.com header.s=default header.b=Mh9VG4Md; spf=pass (google.com: domain of david@lechnology.com designates 206.190.152.46 as permitted sender) smtp.mailfrom=david@lechnology.com Authentication-Results: mx.google.com; dkim=pass header.i=@lechnology.com header.s=default header.b=Mh9VG4Md; spf=pass (google.com: domain of david@lechnology.com designates 206.190.152.46 as permitted sender) smtp.mailfrom=david@lechnology.com Subject: Re: [PATCH 1/2] regmap: fix NULL pointer dereference in regmap_name_read_file() To: Mark Brown Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman References: <1516748023-17235-1-git-send-email-david@lechnology.com> <1516748023-17235-2-git-send-email-david@lechnology.com> <20180124113005.GC9366@sirena.org.uk> From: David Lechner Message-ID: Date: Wed, 24 Jan 2018 10:04:46 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180124113005.GC9366@sirena.org.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - linuxfoundation.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590425592886901979?= X-GMAIL-MSGID: =?utf-8?q?1590490444239005812?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On 01/24/2018 05:30 AM, Mark Brown wrote: > On Tue, Jan 23, 2018 at 04:53:42PM -0600, David Lechner wrote: > >> This fixes a possible NULL pointer dereference oops in >> regmap_name_read_file() when the regmap does not have a device >> associated with it. > > How are you managing to get a regmap without a device associated with > it? > I'm using syscon_regmap_lookup_by_compatible(), which calls: regmap_init_mmio(NULL, base, &syscon_config) NULL being the struct device *dev parameter. There are several clock drivers that do that as well. I'm writing another clock driver and will need to do the same thing for some non-DT boards. I tried using a device, but clocks are initialized fairly early in the boot process and kobject is not initialized yet, so you can't register a platform device at that point.