[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230828145824.3895288-1-andriy.shevchenko@linux.intel.com>
Date: Mon, 28 Aug 2023 17:58:24 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Saravana Kannan <saravanak@...gle.com>,
linux-kernel@...r.kernel.org
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, hdanton@...a.com,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
syzbot+bdfb03b1ec8b342c12cb@...kaller.appspotmail.com
Subject: [PATCH v1 1/1] 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@...kaller.appspotmail.com
Fixes: d21fdd07cea4 ("driver core: Return proper error code when dev_set_name() fails")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/base/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 0d246c060f86..67ba592afc77 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3538,6 +3538,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;
--
2.40.0.1.gaa8946217a0b
Powered by blists - more mailing lists