[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1290192100-11451-1-git-send-email-segoon@openwall.com>
Date: Fri, 19 Nov 2010 21:41:40 +0300
From: Vasiliy Kulikov <segoon@...nwall.com>
To: kernel-janitors@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...e.de>, linux-kernel@...r.kernel.org
Subject: [PATCH] drivers: base: core: do not put noninitialized devices
If kobject_set_name_vargs() fails then put_device() frees
device with zero kobj->state_initialized. This leads to WARN().
Divide device_register() call to device_initialize() call before
kobject_set_name_vargs() and device_add() call after it.
Signed-off-by: Vasiliy Kulikov <segoon@...nwall.com>
---
Compile tested only.
drivers/base/core.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 46ff6c2..833ccf3 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1424,11 +1424,12 @@ struct device *device_create_vargs(struct class *class, struct device *parent,
dev->release = device_create_release;
dev_set_drvdata(dev, drvdata);
+ device_initialize(dev);
retval = kobject_set_name_vargs(&dev->kobj, fmt, args);
if (retval)
goto error;
- retval = device_register(dev);
+ retval = device_add(dev);
if (retval)
goto error;
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists