From patchwork Tue Jan 7 20:54:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 092E0C282DD for ; Tue, 7 Jan 2020 21:16:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1A812072A for ; Tue, 7 Jan 2020 21:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431807; bh=Q8FFZzskH42W+dZJS5N+XgnIUV7Y6jfVYJgYcjiKedE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wYWic4Py26MSXg4qq3FYkdUawy0ie/m+SrOvt7qwJgxcDq5xd6h//6TujU8WpVaOg +YxrYywXKSiKP3FhXEAqyCL58w7ER7RohWpE/b8zPpianiuuTjIIXWxoYYZ2YKhtpZ QngpgysDbbo18HTjn9c2vGWrbow+aEzoQiGaeAUc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729448AbgAGVG6 (ORCPT ); Tue, 7 Jan 2020 16:06:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:56894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729069AbgAGVG5 (ORCPT ); Tue, 7 Jan 2020 16:06:57 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 535B520678; Tue, 7 Jan 2020 21:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431216; bh=Q8FFZzskH42W+dZJS5N+XgnIUV7Y6jfVYJgYcjiKedE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2SZCanrzix3MHRxUjjvd2ezZ7K3UPzWZnMxDQE/cD80b0C4KfKtU8bqEG8scBBel dd4BFqwuY7yiGLxmawEDpMVuP2U44DTxnX546UXcAnG+9q2KKwFIyx0gzxJFYiQrxV Ob/C5Wa7QIXDAf6K+TRxt+mkzZS+exHS69thlJEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonard Crestez , Matthias Kaehlcke , Chanwoo Choi Subject: [PATCH 4.19 080/115] PM / devfreq: Check NULL governor in available_governors_show Date: Tue, 7 Jan 2020 21:54:50 +0100 Message-Id: <20200107205304.594285302@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205240.283674026@linuxfoundation.org> References: <20200107205240.283674026@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leonard Crestez commit d68adc8f85cd757bd33c8d7b2660ad6f16f7f3dc upstream. The governor is initialized after sysfs attributes become visible so in theory the governor field can be NULL here. Fixes: bcf23c79c4e46 ("PM / devfreq: Fix available_governor sysfs") Signed-off-by: Leonard Crestez Reviewed-by: Matthias Kaehlcke Reviewed-by: Chanwoo Choi Signed-off-by: Chanwoo Choi Signed-off-by: Greg Kroah-Hartman --- drivers/devfreq/devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1086,7 +1086,7 @@ static ssize_t available_governors_show( * The devfreq with immutable governor (e.g., passive) shows * only own governor. */ - if (df->governor->immutable) { + if (df->governor && df->governor->immutable) { count = scnprintf(&buf[count], DEVFREQ_NAME_LEN, "%s ", df->governor_name); /*