summaryrefslogtreecommitdiffstats
path: root/fs/sysfs/symlink.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-03 10:23:47 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-07 08:53:32 +0100
commitde96e9fea7ba56042f105b6fe163447b280eb800 (patch)
treed3f6f03da38d0bbe96c587e2bae9e11cb53123ed /fs/sysfs/symlink.c
parentLinux 5.0-rc1 (diff)
downloadlinux-de96e9fea7ba56042f105b6fe163447b280eb800.tar.xz
linux-de96e9fea7ba56042f105b6fe163447b280eb800.zip
sysfs: convert BUG_ON to WARN_ON
It's rude to crash the system just because the developer did something wrong, as it prevents them from usually even seeing what went wrong. So convert the few BUG_ON() calls that have snuck into the sysfs code over the years to WARN_ON() to make it more "friendly". All of these are able to be recovered from, so it makes no sense to crash. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/sysfs/symlink.c')
-rw-r--r--fs/sysfs/symlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index 215c225b2ca1..c4deecc80f67 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -23,7 +23,8 @@ static int sysfs_do_create_link_sd(struct kernfs_node *parent,
{
struct kernfs_node *kn, *target = NULL;
- BUG_ON(!name || !parent);
+ if (WARN_ON(!name || !parent))
+ return -EINVAL;
/*
* We don't own @target_kobj and it may be removed at any time.