diff options
Diffstat (limited to 'drivers/input/input.c')
| -rw-r--r-- | drivers/input/input.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 01c91fec9b7e..0c22250e192a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -2396,6 +2396,14 @@ int input_register_device(struct input_dev *dev) } if (dev->devres_managed) { + if (!dev->dev.parent || + !devres_find(dev->dev.parent, devm_input_device_release, + devm_input_device_match, dev)) { + dev_err(&dev->dev, + "Parent of managed input device was overridden, refusing to register\n"); + return -EINVAL; + } + devres = devres_alloc(devm_input_device_unregister, sizeof(*devres), GFP_KERNEL); if (!devres) |
