From mboxrd@z Thu Jan 1 00:00:00 1970 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.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham 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 2EDEDC74A36 for ; Wed, 10 Jul 2019 18:30:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0FDF92087F for ; Wed, 10 Jul 2019 18:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727553AbfGJSab (ORCPT ); Wed, 10 Jul 2019 14:30:31 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:56234 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727315AbfGJSab (ORCPT ); Wed, 10 Jul 2019 14:30:31 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id BA5D128B47D Message-ID: <85fb2cb764961845a32b8af51e8c6ccebf60c703.camel@collabora.com> Subject: Re: [PATCH v2] PM / devfreq: Fix kernel oops on governor module load From: Ezequiel Garcia To: cwchoi00@gmail.com Cc: Kyungmin Park , MyungJoo Ham , Chanwoo Choi , kernel@collabora.com, Linux PM list , Enric Balletbo i Serra Date: Wed, 10 Jul 2019 15:30:23 -0300 In-Reply-To: References: <20190621213949.27018-1-ezequiel@collabora.com> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hello Chanwoo, On Sat, 2019-06-22 at 19:46 +0900, Chanwoo Choi wrote: > Hi, > > 2019년 6월 22일 (토) 오전 6:42, Ezequiel Garcia 님이 작성: > > 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 > > --- > > Changes from v1: > > * Rework the fix as suggested by Enric and Chanwoo, > > handling the return vaue. > > --- > > drivers/devfreq/devfreq.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > > index 6b6991f0e873..258f70c1e48f 100644 > > --- a/drivers/devfreq/devfreq.c > > +++ b/drivers/devfreq/devfreq.c > > @@ -257,7 +257,7 @@ static struct devfreq_governor *try_then_request_governor(const char *name) > > /* Restore previous state before return */ > > mutex_lock(&devfreq_list_lock); > > if (err) > > - return ERR_PTR(err); > > + return (err < 0) ? ERR_PTR(err) : ERR_PTR(-EINVAL); > > > > governor = find_devfreq_governor(name); > > } > > Thanks you for fix-up. > Reviewed-by: Chanwoo Choi > > But, you are missing the stable mailing list. In order to apply this > fix-up patch,\ > you have to send it to stable mailing list. Please send it. > > If I understand correctly, you or any of the devfreq maintainer can simply add a Cc: stable@vger.kernel.org tag. This is documented as Option 1 in stable-kernel-rules.rst. The Acked-by and Reviewed-by tags need to be collected anyway :-) Thanks! Eze