From patchwork Thu Apr 16 13:24:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 227924 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.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,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 9F7E6C2BB85 for ; Thu, 16 Apr 2020 13:30:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7CB9920767 for ; Thu, 16 Apr 2020 13:30:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587043823; bh=TN8Jsvc4R6VFu2iQk7i/opH8BrugUejtTWKPKNSGQOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MfDaJpI24pWmduziWS/rV4gFjTNclupFANbSUqCM/Cvv8gi2B1Iz0p9HYj320hQM6 aMq8fq+tXiWdXjS93nyMsYzt+hqzVVhztuMKxvsZ5jBpDXCpcu27/z/X7BNY0OXLqK ba1J+oaf+dXgGzbF+OfOsESyUCoDkVztKE3dZ7wI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2896218AbgDPNaV (ORCPT ); Thu, 16 Apr 2020 09:30:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:40520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2896206AbgDPNaU (ORCPT ); Thu, 16 Apr 2020 09:30:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 497FD20767; Thu, 16 Apr 2020 13:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587043819; bh=TN8Jsvc4R6VFu2iQk7i/opH8BrugUejtTWKPKNSGQOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sDRfM1jMRoxfxD1fF2NhMwDk194SYolsk/9rRwhB3oTOWKo9qSkqB03IeFyBs0Svw ngtROKxqe12c9NNIxReG/tM1YgUKHTsRuf75lXysM8Mhtlr933ADTaHK30sU06lT08 samTD+tNuE/A49zUUkw8gbs4Uv7WunHWJPX9kHqU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Andrew Morton , Jessica Yu , Alexei Starovoitov , Jeff Vander Stoep , Kees Cook , Luis Chamberlain , NeilBrown , Linus Torvalds Subject: [PATCH 4.19 112/146] fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() Date: Thu, 16 Apr 2020 15:24:13 +0200 Message-Id: <20200416131257.982156775@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131242.353444678@linuxfoundation.org> References: <20200416131242.353444678@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Biggers 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+] Link: http://lkml.kernel.org/r/20200312202552.241885-3-ebiggers@kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/filesystems.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/filesystems.c +++ b/fs/filesystems.c @@ -267,7 +267,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)) {