[patch 03/17] Driver core: Fix cleanup in device_create_vargs().

From: Greg KH
Date: Sat Oct 18 2008 - 15:04:19 EST


2.6.27-stable review patch. If anyone has any objections, please let us
know.

------------------
From: Cornelia Huck <cornelia.huck@xxxxxxxxxx>

commit 286661b3777897220ecfcd774bccc68a34667f39 upstream

If device_register() in device_create_vargs() fails, the device
must be cleaned up with put_device() (which is also fine on NULL)
instead of kfree().

Signed-off-by: Cornelia Huck <cornelia.huck@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/base/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1243,7 +1243,7 @@ struct device *device_create_vargs(struc
return dev;

error:
- kfree(dev);
+ put_device(dev);
return ERR_PTR(retval);
}
EXPORT_SYMBOL_GPL(device_create_vargs);

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/