The patch titled driver core fixes: device_add() cleanup on error has been added to the -mm tree. Its filename is driver-core-fixes-device_add-cleanup-on-error.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: driver core fixes: device_add() cleanup on error From: Cornelia Huck <cornelia.huck@xxxxxxxxxx> Check for return code of device_create_file() and correct cleanup in the error case in device_add(). Signed-off-by: Cornelia Huck <cornelia.huck@xxxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/base/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff -puN drivers/base/core.c~driver-core-fixes-device_add-cleanup-on-error drivers/base/core.c --- a/drivers/base/core.c~driver-core-fixes-device_add-cleanup-on-error +++ a/drivers/base/core.c @@ -433,14 +433,16 @@ int device_add(struct device *dev) if (dev->driver) dev->uevent_attr.attr.owner = dev->driver->owner; dev->uevent_attr.store = store_uevent; - device_create_file(dev, &dev->uevent_attr); + error = device_create_file(dev, &dev->uevent_attr); + if (error) + goto attrError; if (MAJOR(dev->devt)) { struct device_attribute *attr; attr = kzalloc(sizeof(*attr), GFP_KERNEL); if (!attr) { error = -ENOMEM; - goto PMError; + goto ueventattrError; } attr->attr.name = "dev"; attr->attr.mode = S_IRUGO; @@ -450,7 +452,7 @@ int device_add(struct device *dev) error = device_create_file(dev, attr); if (error) { kfree(attr); - goto attrError; + goto ueventattrError; } dev->devt_attr = attr; @@ -511,6 +513,8 @@ int device_add(struct device *dev) device_remove_file(dev, dev->devt_attr); kfree(dev->devt_attr); } + ueventattrError: + device_remove_file(dev, &dev->uevent_attr); attrError: kobject_uevent(&dev->kobj, KOBJ_REMOVE); kobject_del(&dev->kobj); _ Patches currently in -mm which might be from cornelia.huck@xxxxxxxxxx are driver-core-fixes-make_class_name-retval-check.patch driver-core-fixes-device_register-retval-check-in.patch driver-core-fixes-sysfs_create_link-retval-check-in.patch driver-core-fixes-bus_add_attrs-retval-check.patch driver-core-fixes-bus_add_device-cleanup-on-error.patch driver-core-fixes-device_add-cleanup-on-error.patch driver-core-fixes-device_create_file-retval-check-in.patch driver-core-fixes-sysfs_create_group-retval-in-topologyc.patch git-s390.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html