mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
Driver core fixes for 7.1-rc5
- Remove the software node on platform device release(); without this, the software node remains registered after the device is gone and a subsequent platform_device_register_full() reusing the same node fails with -EBUSY - In sysfs_update_group(), do not remove a pre-existing directory when create_files() fails; the previous code would silently destroy a sysfs group that the caller did not create - Set fwnode->secondary to NULL in fwnode_init() to avoid dereferencing uninitialized memory (e.g. in dev_to_swnode()) when the firmware node is allocated on the stack or via a non-zeroing allocator -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCahGkDAAKCRBFlHeO1qrK Ls4tAP0Ti0VhRJOHz2h3boyp0tXH1bIt082073oJGasHAjnoeQEAg0zbdA2Qkj9o DDv5iX6KYGkeFUzv8MjuWUexc5HlYQ0= =Lc0O -----END PGP SIGNATURE----- Merge tag 'driver-core-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core Pull driver core fixes from Danilo Krummrich: - Remove the software node on platform device release(); without this, the software node remains registered after the device is gone and a subsequent platform_device_register_full() reusing the same node fails with -EBUSY - In sysfs_update_group(), do not remove a pre-existing directory when create_files() fails; the previous code would silently destroy a sysfs group that the caller did not create - Set fwnode->secondary to NULL in fwnode_init() to avoid dereferencing uninitialized memory (e.g. in dev_to_swnode()) when the firmware node is allocated on the stack or via a non-zeroing allocator * tag 'driver-core-7.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: device property: set fwnode->secondary to NULL in fwnode_init() sysfs: don't remove existing directory on update failure driver core: platform: remove software node on release()
This commit is contained in:
commit
c8561c73b4
|
|
@ -606,6 +606,12 @@ static void platform_device_release(struct device *dev)
|
|||
kfree(pa);
|
||||
}
|
||||
|
||||
static void platform_device_release_full(struct device *dev)
|
||||
{
|
||||
device_remove_software_node(dev);
|
||||
platform_device_release(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* platform_device_alloc - create a platform device
|
||||
* @name: base name of the device we're adding
|
||||
|
|
@ -848,7 +854,13 @@ struct platform_device *platform_device_register_full(const struct platform_devi
|
|||
int ret;
|
||||
struct platform_device *pdev;
|
||||
|
||||
if (pdevinfo->swnode && pdevinfo->properties)
|
||||
/*
|
||||
* Only one software node per device is allowed. Make sure we don't
|
||||
* accept or create two.
|
||||
*/
|
||||
if ((pdevinfo->swnode && pdevinfo->properties) ||
|
||||
(pdevinfo->swnode && is_software_node(pdevinfo->fwnode)) ||
|
||||
(pdevinfo->properties && is_software_node(pdevinfo->fwnode)))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id);
|
||||
|
|
@ -878,6 +890,8 @@ struct platform_device *platform_device_register_full(const struct platform_devi
|
|||
ret = device_add_software_node(&pdev->dev, pdevinfo->swnode);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
pdev->dev.release = platform_device_release_full;
|
||||
} else if (pdevinfo->properties) {
|
||||
ret = device_create_managed_software_node(&pdev->dev,
|
||||
pdevinfo->properties, NULL);
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ static int internal_create_group(struct kobject *kobj, int update,
|
|||
kernfs_get(kn);
|
||||
error = create_files(kn, kobj, uid, gid, grp, update);
|
||||
if (error) {
|
||||
if (grp->name)
|
||||
if (grp->name && !update)
|
||||
kernfs_remove(kn);
|
||||
}
|
||||
kernfs_put(kn);
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ struct fwnode_operations {
|
|||
static inline void fwnode_init(struct fwnode_handle *fwnode,
|
||||
const struct fwnode_operations *ops)
|
||||
{
|
||||
fwnode->secondary = NULL;
|
||||
fwnode->ops = ops;
|
||||
INIT_LIST_HEAD(&fwnode->consumers);
|
||||
INIT_LIST_HEAD(&fwnode->suppliers);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user