From patchwork Sat Mar 14 21:34:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 229394 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, URIBL_BLOCKED, 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 168FBC0044D for ; Sun, 15 Mar 2020 02:25:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8FEE20578 for ; Sun, 15 Mar 2020 02:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584239108; bh=b6MuOpiS2xvMFw14CDhCFUowRT5zjT0d4DxRNwi5BuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DAEhEwSQV6b+CyIYDBLN1PAcShRh+bYGrrK0Tp01NS/Ft47Aj8vaUTXQ1AatQsrsS bVH46ewUXo6l6eq45YLQ0YUA5PWnFYsTfqA4dvTB/33GcZuBmP0MB7sNuyHfNm2wnQ XdCu7Mnua5kJvy/aiksPrStW0JpD4TXuauwBPo0I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbgCOCY7 (ORCPT ); Sat, 14 Mar 2020 22:24:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727923AbgCOCYN (ORCPT ); Sat, 14 Mar 2020 22:24:13 -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 2EC762082D; Sat, 14 Mar 2020 21:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584221808; bh=b6MuOpiS2xvMFw14CDhCFUowRT5zjT0d4DxRNwi5BuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fWV8HZeeCoTyeew/nQtxVFj+FOH7LTGMjRB5BeNfEtvSl96zaOVgU807U3sp12O5F +qlQvfrBjX/Q0YX0KeZ1JRgtWQsLIl7xRBMCdd4bCv0ZLEmxwCgEVH6XH6WLShQXQc hyx3SNr+OfmXJYFcUN1Eil+iyH+Gj5MM5N3OT0hw= 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 v3 2/5] fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once() Date: Sat, 14 Mar 2020 14:34:23 -0700 Message-Id: <20200314213426.134866-3-ebiggers@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200314213426.134866-1-ebiggers@kernel.org> References: <20200314213426.134866-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(). Acked-by: Luis Chamberlain 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: 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)) {