diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-08-28 16:58:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-09-12 15:54:44 +0200 |
commit | fd6f7ad2fd4d53fa14f4fd190f9b05d043973892 (patch) | |
tree | 148c2f6ab0d6b4080ecbff4fda002ffc9defab3b /drivers | |
parent | Linux 6.6-rc1 (diff) | |
download | linux-fd6f7ad2fd4d53fa14f4fd190f9b05d043973892.tar.xz linux-fd6f7ad2fd4d53fa14f4fd190f9b05d043973892.zip |
driver core: return an error when dev_set_name() hasn't happened
The commit d21fdd07cea4 ("driver core: Return proper error code when
dev_set_name() fails") rewrote the logic of handling the dev_set_name()
error codes, but missed the point that initially set error value to
-EINVAL might be rewritten and hence the error path can't be triggered
at some circumstances. To fix this, make sure that error variable is
set to -EINVAL when other conditionals are false.
Reported-by: syzbot+bdfb03b1ec8b342c12cb@syzkaller.appspotmail.com
Fixes: d21fdd07cea4 ("driver core: Return proper error code when dev_set_name() fails")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230828145824.3895288-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index b7d7f410c256..4d8b315c48a1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3537,6 +3537,8 @@ int device_add(struct device *dev) /* subsystems can specify simple device enumeration */ else if (dev->bus && dev->bus->dev_name) error = dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id); + else + error = -EINVAL; if (error) goto name_error; |