From patchwork Thu Mar 12 20:25:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 229405 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=unavailable 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 AAF4FC1975A for ; Thu, 12 Mar 2020 20:26:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 763A82071C for ; Thu, 12 Mar 2020 20:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584044790; bh=bWBPGbnoq1gsV/od0+q6ePbfuTyl4bo3BQ9ZHQN2Upw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dSG73xEmxmdxbY3DBnA2Mo2+IHGTgTrA7jiCMS15AlRHKApboNfqb7yRmuTNw0u04 4rHyxf7lh56wvgVPuF+XGCpTjWo+5gXAYIIaiQppqAIXKqqYD84TA1NzeIZ3riFkzy UFByvojlP/ZFwxhw9lP3JYrqtX+wE8AqLZC9qmbQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbgCLU0L (ORCPT ); Thu, 12 Mar 2020 16:26:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbgCLU0K (ORCPT ); Thu, 12 Mar 2020 16:26:10 -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 3AD8520736; Thu, 12 Mar 2020 20:26:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584044769; bh=bWBPGbnoq1gsV/od0+q6ePbfuTyl4bo3BQ9ZHQN2Upw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2j95iuZlCEFaWRaEES+nsFFRHHgvudlOwgmRy1zfqIk81m67Ep+sWQNAIQtNCahiX Wk7OkDM40aphur5j636uscEEnij9ORNzHLqKW4PeWo56DbbFFLiNgd/6lZ/GX+eWZe S8pvEV0o6H+m0GF4XtW5gX+Cs58SLdfRlDyI7+RE= 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 v2 2/4] fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() Date: Thu, 12 Mar 2020 13:25:50 -0700 Message-Id: <20200312202552.241885-3-ebiggers@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200312202552.241885-1-ebiggers@kernel.org> References: <20200312202552.241885-1-ebiggers@kernel.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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(). Cc: stable@vger.kernel.org Cc: Alexei Starovoitov Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Jeff Vander Stoep Cc: Jessica Yu Cc: Kees Cook Cc: Luis Chamberlain 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)) {