From: Paul Walmsley Date: Sat, 25 Apr 2009 11:28:36 +0000 (-0600) Subject: regulator core: fix double-free in regulator_register() error path X-Git-Tag: v2.6.30-rc4~8^2~3 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53032dafc6b93ac178ca2340ff8eb4ee2b3d1a92;p=pandora-kernel.git regulator core: fix double-free in regulator_register() error path During regulator registration, any error after device_register() will cause a double-free on the struct regulator_dev 'rdev'. The bug is in drivers/regulator/core.c:regulator_register(): ... scrub: device_unregister(&rdev->dev); clean: kfree(rdev); <--- rdev = ERR_PTR(ret); goto out; ... device_unregister() calls regulator_dev_release() which frees rdev. The subsequent kfree corrupts memory and causes some OMAP3 systems to oops on boot in regulator_get(). Applies against 2.6.30-rc3. Signed-off-by: Paul Walmsley Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- Reading git-diff-tree failed