mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-28 09:06:11 -05:00
Merge tag 'devprop-5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties framework fix from Rafael Wysocki: "Prevent the promotion of the secondary firmware node of a device to the primary one from leaking a pointer (Heikki Krogerus)" * tag 'devprop-5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: device property: Fix the secondary firmware node handling in set_primary_fwnode()
This commit is contained in:
@@ -4264,9 +4264,9 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
|
||||
*/
|
||||
void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
|
||||
{
|
||||
if (fwnode) {
|
||||
struct fwnode_handle *fn = dev->fwnode;
|
||||
struct fwnode_handle *fn = dev->fwnode;
|
||||
|
||||
if (fwnode) {
|
||||
if (fwnode_is_primary(fn))
|
||||
fn = fn->secondary;
|
||||
|
||||
@@ -4276,8 +4276,12 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
|
||||
}
|
||||
dev->fwnode = fwnode;
|
||||
} else {
|
||||
dev->fwnode = fwnode_is_primary(dev->fwnode) ?
|
||||
dev->fwnode->secondary : NULL;
|
||||
if (fwnode_is_primary(fn)) {
|
||||
dev->fwnode = fn->secondary;
|
||||
fn->secondary = NULL;
|
||||
} else {
|
||||
dev->fwnode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(set_primary_fwnode);
|
||||
|
||||
Reference in New Issue
Block a user