History

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()

Linus Torvalds committed 6 years ago

Commit 005c5342 parents 0b2f18e c15e1bd1 file · +8 −4Browse files

Unified · Split

drivers/base/core.c+8−4
@@ -4264,9 +4264,9 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode) · 4263 unmodified lines
42644264 */
42654265 void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
42664266 {
4267− if (fwnode) {
4268− struct fwnode_handle *fn = dev->fwnode;
4267+ struct fwnode_handle *fn = dev->fwnode;
42694268
4269+ if (fwnode) {
42704270 if (fwnode_is_primary(fn))
42714271 fn = fn->secondary;
42724272
@@ -4276,8 +4276,12 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) · 3 unmodified lines
42764276 }
42774277 dev->fwnode = fwnode;
42784278 } else {
4279− dev->fwnode = fwnode_is_primary(dev->fwnode) ?
4280− dev->fwnode->secondary : NULL;
4279+ if (fwnode_is_primary(fn)) {
4280+ dev->fwnode = fn->secondary;
4281+ fn->secondary = NULL;
4282+ } else {
4283+ dev->fwnode = NULL;
4284+ }
42814285 }
42824286 }
42834287 EXPORT_SYMBOL_GPL(set_primary_fwnode);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t