From patchwork Mon Jan 22 14:57:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 10178709 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FB79600F5 for ; Mon, 22 Jan 2018 14:58:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F73928112 for ; Mon, 22 Jan 2018 14:58:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 438E328173; Mon, 22 Jan 2018 14:58:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC95D28112 for ; Mon, 22 Jan 2018 14:58:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751110AbeAVO6B (ORCPT ); Mon, 22 Jan 2018 09:58:01 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:46794 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750848AbeAVO6A (ORCPT ); Mon, 22 Jan 2018 09:58:00 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 60303F07; Mon, 22 Jan 2018 14:57:59 +0000 (UTC) Date: Mon, 22 Jan 2018 15:57:59 +0100 From: Greg KH To: Dmitry Vyukov Cc: syzbot , LKML , syzkaller-bugs@googlegroups.com, David Miller , Daniel Borkmann , Eric Dumazet , jakub.kicinski@netronome.com, Willem de Bruijn , Rasmus Villemoes , John Fastabend , "Tobin C. Harding" , netdev , linux-wireless@vger.kernel.org Subject: [PATCH] sysfs: turn WARN() into pr_warn() Message-ID: <20180122145759.GA18798@kroah.com> References: <001a11c14bc837f9760560a03d51@google.com> <20171219090121.GA10221@kroah.com> <20180122140015.GA30036@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Greg Kroah-Hartman It's not good to crash the machine if panic_on_warn() is set just because someone made a stupid mistake of trying to create a sysfs file with the same name of an existing one. This makes the automated testing tools a lot harder to find the real bugs in the kernel. So just print a warning out and dump the stack to get the attention of the developer that they did something foolish. Then keep on trucking, as this should not be a fatal error at all. Reported-by: Dmitry Vyukov Signed-off-by: Greg Kroah-Hartman --- Dmitry, does this look good to you? If so, I'll queue it up for 4.16-rc1. diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 2b67bda2021b..3a36a48a4b3f 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -10,6 +10,7 @@ * Please see Documentation/filesystems/sysfs.txt for more information. */ +#define pr_fmt(fmt) "sysfs: " fmt #undef DEBUG #include @@ -27,8 +28,8 @@ void sysfs_warn_dup(struct kernfs_node *parent, const char *name) if (buf) kernfs_path(parent, buf, PATH_MAX); - WARN(1, KERN_WARNING "sysfs: cannot create duplicate filename '%s/%s'\n", - buf, name); + pr_warn("cannot create duplicate filename '%s/%s'\n", buf, name); + dump_stack(); kfree(buf); }