Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752346AbdLGCmH (ORCPT ); Wed, 6 Dec 2017 21:42:07 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:40076 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751990AbdLGCmF (ORCPT ); Wed, 6 Dec 2017 21:42:05 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20171207024203epoutp042e05d4edc3ac1f780d6ae3c19642d911~94uU0aKZx2074020740epoutp044 X-AuditID: b6c32a37-413ff70000001041-76-5a28aa682c82 Mime-Version: 1.0 Subject: RE: [PATCH] PM / devfreq: Fix potential NULL pointer dereference in governor_store Reply-To: myungjoo.ham@samsung.com From: MyungJoo Ham To: Kyungmin Park , Chanwoo Choi CC: "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Gustavo A. R. Silva" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20171206202015.GA15636@embeddedor.com> X-Drm-Type: N,general X-EPWebmail-Msg-Type: personal X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20171207024144epcms1p4d7e1a981c7c307190a85e8c35174d983@epcms1p4> Date: Thu, 07 Dec 2017 02:41:44 +0000 X-CMS-MailID: 20171207024144epcms1p4d7e1a981c7c307190a85e8c35174d983 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-MTR: 20171207024144epcms1p4d7e1a981c7c307190a85e8c35174d983 CMS-TYPE: 101P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJKsWRmVeSWpSXmKPExsWy7bCmrm7GKo0og93LbCyuf3nOarFyyX42 i7NNb9gtLu+aw2bxufcIowOrx7qDqh59W1YxenzeJBfAHJVqk5GamJJapJCal5yfkpmXbqvk HRzvHG9qZmCoa2hpYa6kkJeYm2qr5OIToOuWmQO0UUmhLDGnFCgUkFhcrKRvZ1OUX1qSqpCR X1xiqxRtaGikZ2hgrmdkZKRnYhxrZWQKVJKQmvGr4T1bwWK2iv4NTYwNjNNYuxg5OSQETCQ+ P3sFZgsJ7GCUmHqauYuRg4NXQFDi7w5hkLCwQKzE5p/rGCFKlCQabu5jhojrS3Q82AYWZxPQ ldi64S4LiC0iECoxpf02UA0XB7PAWkaJZYeXMEHs4pWY0f6UBcKWlti+fCtYMyfQDZN3XmSD iItK3Fz9lh3ClpOY9nUNM0z8/bH5jBC2iETrvbNQcUGJBz93Q8UlJZYcaIKK10tc/7yICeQI CYEJjBK/b/yHGqov8ejKbLBlvAK+Ei+bj4IdxyKgKvFpTQPUoS4S059NBAcKs4C8xPa3c8CB wiygKbF+lz5Eia3Emoe32SBK+CTefe1hhflxx7wnUGPUJA7tXgK1Vkbi9PSFULd5SFx7+YFl AqPSLERQz0KybBbCsgWMzKsYxVILinPTU4sNC4z1ihNzi0vz0vWS83M3MYKTnZb5DsYN53wO MQpwMCrx8Fr8Uo8SYk0sK67MPcQowcGsJML7u18jSog3JbGyKrUoP76oNCe1+BCjKdDPE5ml RJPzgYk4ryTe0MTSwMTMCJjiLA0NlcR5xdZfixASSE8sSc1OTS1ILYLpY+LglGpgdE53lo7j N/S/vv9J0yUW52MzZZfwSfmel9O8FJ3Jo3xVIGMP06PnupGcdvGrnQpDX+8T76lWcbS788Vw //+Nfgt+RMSbntk5Qc5V+sbiORlhgbll0kyCy8UnlUlL/Hnm+nDZLBvZw8GW0xb/X7jhhPc0 M6mpHgfFnvKerspdt2d/TPXcI7/LlFiKMxINtZiLihMBkhm+94wDAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20171206202020epcas3p4fe9a9fb5346f2d413199ed71d1d0f19f X-RootMTR: 20171206202020epcas3p4fe9a9fb5346f2d413199ed71d1d0f19f References: <20171206202015.GA15636@embeddedor.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 779 Lines: 24 > df->governor is being dereferenced before it is null checked, > hence there is a potential null pointer dereference. > > Notice that df->governor is being null checked at line 1004: > if (df->governor) {, which implies it might be null. > > Fix this by null checking df->governor before dereferencing it. > > Addresses-Coverity-ID: 1401988 ("Dereference before null check") > Fixes: bcf23c79c4e4 ("PM / devfreq: Fix available_governor sysfs") > Signed-off-by: Gustavo A. R. Silva Acked-by: MyungJoo Ham Cheers, MyungJoo > --- > drivers/devfreq/devfreq.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index 78fb496..14fe76b 100644