blob: f450bef7acaf7048ea06392d4d364dc2ac6f4993 [file] [log] [blame]
From 405f6b28216249a7c6d17426d497991ed6992b3a Mon Sep 17 00:00:00 2001
From: Eric Biggers <>
Date: Fri, 10 Apr 2020 14:33:47 -0700
Subject: [PATCH] fs/filesystems.c: downgrade user-reachable WARN_ONCE() to
commit 26c5d78c976ca298e59a56f6101a97b618ba3539 upstream.
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")
Signed-off-by: Eric Biggers <>
Signed-off-by: Andrew Morton <>
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: Linus Torvalds <>
Signed-off-by: Paul Gortmaker <>
diff --git a/fs/filesystems.c b/fs/filesystems.c
index 9135646e41ac..5e1a19013373 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -271,7 +271,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)) {