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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 44173C4332B for ; Wed, 18 Mar 2020 23:06:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 185F42076E for ; Wed, 18 Mar 2020 23:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584572783; bh=dUCSWxYUurc+Drotp7J4F6yRdq0QEiO/fiS1TK31ano=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xQN88qr4+S4kvZF5LJeiU3f4Of2CVyFj6zXxb0DgGoYy14tVy4wGU0OFtbOxsYu3t /OPyMPXcDe1r8vGugnvX1AD3YUiufm8eeIBHlOxIX9OtrVyh04L0ajeoKH5/Jo0wrU ph5D1vpPhwvFDOIjzkIQKxQTx8D83720pnrTKXdo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727384AbgCRXGS (ORCPT ); Wed, 18 Mar 2020 19:06:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:37510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbgCRXGP (ORCPT ); Wed, 18 Mar 2020 19:06:15 -0400 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5184320776; Wed, 18 Mar 2020 23:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584572774; bh=dUCSWxYUurc+Drotp7J4F6yRdq0QEiO/fiS1TK31ano=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsyBzEdN1TPH7R3GZId7GXtYOTZUr5WTh3bM+hnXjhBu4XAwnXe+fQQzjwVZqRyuP pylThAiKxfGXAbl4vGLRWOFH7PUBSAQDVkzZcbZC/tGBPgoGH+m20J9oJ54c/jt4zs 15rXAobX2Hmnq4tN5y0TiAikCBzl/3ASt9H6G4GU= From: Eric Biggers To: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, Alexei Starovoitov , Andrew Morton , Greg Kroah-Hartman , Jeff Vander Stoep , Jessica Yu , Kees Cook , Luis Chamberlain , NeilBrown , stable@vger.kernel.org Subject: [PATCH v4 2/5] fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() Date: Wed, 18 Mar 2020 16:05:12 -0700 Message-Id: <20200318230515.171692-3-ebiggers@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200318230515.171692-1-ebiggers@kernel.org> References: <20200318230515.171692-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers 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. Fixes: 41124db869b7 ("fs: warn in case userspace lied about modprobe return") Acked-by: Luis Chamberlain Reviewed-by: Jessica Yu Cc: # v4.13+ Cc: Alexei Starovoitov Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Jeff Vander Stoep Cc: Kees Cook Cc: NeilBrown Signed-off-by: Eric Biggers --- fs/filesystems.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/filesystems.c b/fs/filesystems.c index 77bf5f95362da..90b8d879fbaf3 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c @@ -272,7 +272,9 @@ struct file_system_type *get_fs_type(const char *name) 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)) { -- 2.25.1