Skip to content

Commit

Permalink
sysfs: turn WARN() into pr_warn()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed Jan 22, 2018
1 parent a9afc57 commit 5d54f94
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/sysfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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);
}
Expand Down

0 comments on commit 5d54f94

Please sign in to comment.