[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191128075312.GA3362744@kroah.com>
Date: Thu, 28 Nov 2019 08:53:12 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@...hiba.co.jp>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>,
Enric Balletbo i Serra <enric.balletbo@...labora.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 216/220] PM / devfreq: Fix static checker warning in
try_then_request_governor
On Thu, Nov 28, 2019 at 12:40:20PM +0900, Nobuhiro Iwamatsu wrote:
> Hi,
>
> On Fri, Nov 22, 2019 at 11:29:41AM +0100, Greg Kroah-Hartman wrote:
> > From: Enric Balletbo i Serra <enric.balletbo@...labora.com>
> >
> > [ Upstream commit b53b0128052ffd687797d5f4deeb76327e7b5711 ]
> >
> > The patch 23c7b54ca1cd: "PM / devfreq: Fix devfreq_add_device() when
> > drivers are built as modules." leads to the following static checker
> > warning:
> >
> > drivers/devfreq/devfreq.c:1043 governor_store()
> > warn: 'governor' can also be NULL
> >
> > The reason is that the try_then_request_governor() function returns both
> > error pointers and NULL. It should just return error pointers, so fix
> > this by returning a ERR_PTR to the error intead of returning NULL.
> >
> > Fixes: 23c7b54ca1cd ("PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.")
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@...labora.com>
> > Reviewed-by: Chanwoo Choi <cw00.choi@...sung.com>
> > Signed-off-by: MyungJoo Ham <myungjoo.ham@...sung.com>
> > Signed-off-by: Sasha Levin <sashal@...nel.org>
>
> The following commits are provided for this fix:
>
> commit 7544fd7f384591038646d3cd9efb311ab4509e24
> Author: Ezequiel Garcia <ezequiel@...labora.com>
> Date: Fri Jun 21 18:39:49 2019 -0300
>
> PM / devfreq: Fix kernel oops on governor module load
>
> A bit unexpectedly (but still documented), request_module may
> return a positive value, in case of a modprobe error.
> This is currently causing issues in the devfreq framework.
>
> When a request_module exits with a positive value, we currently
> return that via ERR_PTR. However, because the value is positive,
> it's not a ERR_VALUE proper, and is therefore treated as a
> valid struct devfreq_governor pointer, leading to a kernel oops.
>
> Fix this by returning -EINVAL if request_module returns a positive
> value.
>
> Fixes: b53b0128052ff ("PM / devfreq: Fix static checker warning in try_then_request_governor")
> Signed-off-by: Ezequiel Garcia <ezequiel@...labora.com>
> Reviewed-by: Chanwoo Choi <cw00.choi@...sung.com>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@...sung.com>
>
> Please apply.
Good catch, now queued up.
greg k-h
Powered by blists - more mailing lists