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 KH X-Patchwork-Id: 864270 X-Patchwork-Delegate: linville@tuxdriver.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zQF115xFgz9s9Y for ; Tue, 23 Jan 2018 01:58:13 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbeAVO6B (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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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); }