Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp188183yba; Tue, 23 Apr 2019 22:36:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxgfUmecb67JZAUfcJYEQivhuRjPBAFLZmIjGpOKnRS6rAwCQPkWguXJZT/9cJJpO8u9t4 X-Received: by 2002:a63:1d4f:: with SMTP id d15mr27955598pgm.347.1556084165717; Tue, 23 Apr 2019 22:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556084165; cv=none; d=google.com; s=arc-20160816; b=AWu2+0s1d94o8IWWS8+pjRVi4IuBoSdxqTjyLbfJoqh3eTAP5loR+d3kKgFnCAN6CF zMQ3j6YZPW17U7E82JHXO7I65ICqWQkQ6QJkbiNjhSdG6lC06NUFYbZ4+KyxNRha+Yub rAjL6Un+7hJPzrhfoquz59m4U76w4IJ7sySG3Fgp+KTUXAcnHYO3GdrWXyPoW5H6mTJO 3c+B7UWG5bz6ahYW2/hJUePXKHjfHQzq6ixTsQSsuhrgKCyNhm8IuN0F7ZM94Ykdb3n8 AQtIFbPK4l8e5S6wg5yL8SIszhVTjFghFKw4v7+vqVsl++PIMiuosD7TOgRP0htOziQI pWhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=bdru01AkYPwaXTH6ik0KxzmcN+kLTAFWhksk6mGVxcE=; b=Y70wK7sdBHmwEyaWT71IY5GzIPzMDAJtQmNfFivQBkPtMBTu00hpUjf4kP/TfY4Boq y9EBSS1tO2XUelJRVY16rG2jZAklSSEsedn5A6uzvS0M66QhCUux6zbTOz3qmq7xB3Vk bqQlajy5CCgaAI0eedF51ffHk3IO2isR34BbKEf08NNaoEuS5lvAGaHsysUVH3jPjslQ gFSAv8rb2eajvLzb7mbrIGLE51HPfrk7Y7xos5zWr4vdRERy1lbvlLgtXC0+tenTzVM6 LuW57smCmvf0RzTSXWgXa3VysZOzBEUvreP9fpy5LdpRkBEzXcFVBwMTPKphvbiah5sY CpRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si16310626pgv.128.2019.04.23.22.35.49; Tue, 23 Apr 2019 22:36:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729511AbfDXFeS (ORCPT + 99 others); Wed, 24 Apr 2019 01:34:18 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:52581 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725919AbfDXFeS (ORCPT ); Wed, 24 Apr 2019 01:34:18 -0400 Received: by mail-it1-f195.google.com with SMTP id x132so4218393itf.2; Tue, 23 Apr 2019 22:34:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bdru01AkYPwaXTH6ik0KxzmcN+kLTAFWhksk6mGVxcE=; b=OhxnTeNJfQKmcaodxAepMHE4xVyLhk5/usluSvS1werk2G8V9x3sVY1qEk8OTuyaOT oBt0ZeVb4a4PloMMMeop441S1Y6xOIlkDn0CWRIRC+1Dor8gCRRrmoCis7o6ZJWYHJ7E GAVibv3fa/bAY7W4jEXgQrNk+KgdPHjbFtxxgqRSNZhfWsRGg5vwIEG2W/IY/K2h27eG L3FfUz2RnEG/oAkMaXaGwJRvV9gFMa7UMr0msnm5x1nifqj2/uXP38TP8apbDCVygiPx Xus08WmQOhU8dNAv6bJQDJ4F89qGNy2BmPjn+Y+oRQiGNAbB3ySsuz9Pvj7/fgIN35+g j9VQ== X-Gm-Message-State: APjAAAV2GJhvUSA5ST9wrCrTajmiMAvtTLpp/GAjVpYjUlbiC8Zk2k+e rJ65lp73JIbSu1CP6HLuB06qvzjeNMaihzVOGi5CVJ+B X-Received: by 2002:a02:c790:: with SMTP id n16mr20159814jao.102.1556084057312; Tue, 23 Apr 2019 22:34:17 -0700 (PDT) MIME-Version: 1.0 References: <20190423081158.29859-1-tomeu.vizoso@collabora.com> In-Reply-To: From: Tomeu Vizoso Date: Wed, 24 Apr 2019 07:34:06 +0200 Message-ID: Subject: Re: [PATCH] PM / devfreq: Return -ENODEV from try_then_request_governor To: Enric Balletbo i Serra Cc: open list , Alyssa Rosenzweig , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Apr 2019 at 11:56, Enric Balletbo i Serra wrote: > > Hi Tomeu, > > On 23/4/19 10:11, Tomeu Vizoso wrote: > > Callers don't expect it to return NULL, but an error code. > > > > Fixes Oops such as the one below, when one tries to set a governor that > > isn't available: > > > > Unable to handle kernel NULL pointer dereference at virtual address 00000018 > > > > [] (governor_store) from [] (kernfs_fop_write+0x100/0x1e0) > > [] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x17c) > > [] (__vfs_write) from [] (vfs_write+0xa4/0x184) > > [] (vfs_write) from [] (ksys_write+0x4c/0xac) > > [] (ksys_write) from [] (ret_fast_syscall+0x0/0x28) > > > > Signed-off-by: Tomeu Vizoso > > Fixes: 23c7b54ca1cd ("PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.") > > Reported-by: Alyssa Rosenzweig > > Cc: Enric Balletbo i Serra > > --- > > There is already a fix for that. The fix was initially sent in October [2] but > unfortunately it got lost. I resend and now is queued [1]. Hopefully the Fixes > tag will help to pick the fix to the proper kernel releases. Actually, Steve Price sent a third patch for this same issue. Glad to read that it's being merged. Thanks, Tomeu > Thanks, > Enric > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq.git/commit/?h=for-next&id=b53b0128052ffd687797d5f4deeb76327e7b5711 > > [2] https://lkml.org/lkml/2018/10/16/744 > > > 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 0ae3de76833b..5539e9be718d 100644 > > --- a/drivers/devfreq/devfreq.c > > +++ b/drivers/devfreq/devfreq.c > > @@ -254,7 +254,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 NULL; > > + return ERR_PTR(-ENODEV); > > > > governor = find_devfreq_governor(name); > > } > >