From: Greg KH <gregkh@linuxfoundation.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: syzbot
<bot+1fdad4e2731bf0c1bc19953ccc5061237ec92783@syzkaller.appspotmail.com>,
LKML <linux-kernel@vger.kernel.org>,
syzkaller-bugs@googlegroups.com,
David Miller <davem@davemloft.net>,
Daniel Borkmann <daniel@iogearbox.net>,
Eric Dumazet <edumazet@google.com>,
jakub.kicinski@netronome.com,
Willem de Bruijn <willemb@google.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
John Fastabend <john.fastabend@gmail.com>,
"Tobin C. Harding" <me@tobin.cc>, netdev <netdev@vger.kernel.org>,
linux-wireless@vger.kernel.org
Subject: [PATCH] sysfs: turn WARN() into pr_warn()
Date: Mon, 22 Jan 2018 15:57:59 +0100 [thread overview]
Message-ID: <20180122145759.GA18798@kroah.com> (raw)
In-Reply-To: <CACT4Y+bEG22Wa6hiBQ6YX7d=JrHKAXfwYm+tu6cWc7AiUZxYbw@mail.gmail.com>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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 <dvyukov@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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 <linux/fs.h>
@@ -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);
}
next prev parent reply other threads:[~2018-01-22 14:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <001a11c14bc837f9760560a03d51@google.com>
[not found] ` <20171219090121.GA10221@kroah.com>
[not found] ` <CACT4Y+ZggKsEjCRZsFPW5-7_ByBcz4G0uRdieLL==r4mLQjhFA@mail.gmail.com>
2017-12-19 9:06 ` WARNING in sysfs_warn_dup Dmitry Vyukov
2018-01-22 13:47 ` Dmitry Vyukov
2018-01-22 14:00 ` Greg KH
2018-01-22 14:30 ` Dmitry Vyukov
2018-01-22 14:45 ` Greg KH
[not found] ` <20180122144547.GA3375-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2018-01-22 15:04 ` Dmitry Vyukov
2018-01-22 14:57 ` Greg KH [this message]
2018-01-22 15:04 ` [PATCH] sysfs: turn WARN() into pr_warn() Dmitry Vyukov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180122145759.GA18798@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=bot+1fdad4e2731bf0c1bc19953ccc5061237ec92783@syzkaller.appspotmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dvyukov@google.com \
--cc=edumazet@google.com \
--cc=jakub.kicinski@netronome.com \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=me@tobin.cc \
--cc=netdev@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox