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=-3.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,URIBL_BLOCKED autolearn=no 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 B80C9C2BBFD for ; Fri, 10 Apr 2020 21:33:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91AED21556 for ; Fri, 10 Apr 2020 21:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586554429; bh=ck61gAKMCOZGyQ5F1WxYtliEKRvgStAxqlgmwfklr9o=; h=Date:From:To:Subject:In-Reply-To:List-ID:From; b=C5vT+9SOCsO6M0Zsy6JmuEvFDL731XkcViHPmClgVygq0VXd6MayXLssnhmFJKUF5 yKTDPuL9c2fE3zWG+UXaJm3I95NdV5F1tcPdc5FNQEGd/V3CTKesk+NP/ksUVr4V9A maHm0C/QnaHW6lUwV7LQdfhI4naM4MjAqqRlkeZA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726712AbgDJVds (ORCPT ); Fri, 10 Apr 2020 17:33:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:47950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbgDJVdr (ORCPT ); Fri, 10 Apr 2020 17:33:47 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 A581F215A4; Fri, 10 Apr 2020 21:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586554428; bh=ck61gAKMCOZGyQ5F1WxYtliEKRvgStAxqlgmwfklr9o=; h=Date:From:To:Subject:In-Reply-To:From; b=pAcM0ax2JIotRyjuoIWWF3Fo+OkhL2S77Qt2yUFT4nGQAkI4aNtQ94LQtB9nqVZGM AZ8ri7CqltVM1STcKjVLtoW5/QDgyJJkO1Qpd46iyP2MkfnSEAGPZ5z91EYCvEEYOy +duElrlWzuC86zsmAX8iOQY/7ivzvImqY7chUEBo= Date: Fri, 10 Apr 2020 14:33:47 -0700 From: Andrew Morton To: akpm@linux-foundation.org, ast@kernel.org, ebiggers@google.com, gregkh@linuxfoundation.org, jeffv@google.com, jeyu@kernel.org, keescook@chromium.org, linux-mm@kvack.org, mcgrof@kernel.org, mm-commits@vger.kernel.org, neilb@suse.com, stable@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 27/35] fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() Message-ID: <20200410213347.RHoMObc5Z%akpm@linux-foundation.org> In-Reply-To: <20200410143047.bf34a933ce1affdc042c7c80@linux-foundation.org> User-Agent: s-nail v14.8.16 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Biggers Subject: fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() After request_module(), nothing is stopping the module from being unloaded until someone takes a reference to it via try_get_module(). The WARN_ONCE() in get_fs_type() is thus user-reachable, via userspace running 'rmmod' concurrently. Since WARN_ONCE() is for kernel bugs only, not for user-reachable situations, downgrade this warning to pr_warn_once(). Keep it printed once only, since the intent of this warning is to detect a bug in modprobe at boot time. Printing the warning more than once wouldn't really provide any useful extra information. Link: http://lkml.kernel.org/r/20200312202552.241885-3-ebiggers@kernel.org Fixes: 41124db869b7 ("fs: warn in case userspace lied about modprobe return") Signed-off-by: Eric Biggers Reviewed-by: Jessica Yu Cc: Alexei Starovoitov Cc: Greg Kroah-Hartman Cc: Jeff Vander Stoep Cc: Jessica Yu Cc: Kees Cook Cc: Luis Chamberlain Cc: NeilBrown Cc: [4.13+] Signed-off-by: Andrew Morton --- fs/filesystems.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/filesystems.c~fs-filesystemsc-downgrade-user-reachable-warn_once-to-pr_warn_once +++ a/fs/filesystems.c @@ -272,7 +272,9 @@ struct file_system_type *get_fs_type(con fs = __get_fs_type(name, len); if (!fs && (request_module("fs-%.*s", len, name) == 0)) { fs = __get_fs_type(name, len); - WARN_ONCE(!fs, "request_module fs-%.*s succeeded, but still no fs?\n", len, name); + if (!fs) + pr_warn_once("request_module fs-%.*s succeeded, but still no fs?\n", + len, name); } if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) { _