diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-11-12 10:26:57 -0800 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-16 23:10:20 +0100 |
commit | 6f9b36cd2497660e254c67ed131f0b297ed8bf40 (patch) | |
tree | 301a3d5ea54c58d364a5241d4fdc6dfac3d9f534 /drivers/base | |
parent | d439e64f22ce0eea681ae90c71f584d3a0145ded (diff) | |
download | linux-stable-6f9b36cd2497660e254c67ed131f0b297ed8bf40.tar.gz linux-stable-6f9b36cd2497660e254c67ed131f0b297ed8bf40.tar.bz2 linux-stable-6f9b36cd2497660e254c67ed131f0b297ed8bf40.zip |
PM / wakeirq: check that wake IRQ is valid before accepting it
Check that IRQ number passed to dev_pm_set_wake_irq() and
dev_pm_set_dedicated_wake_irq() is valid (not negative) before
accepting it.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/wakeirq.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c index eb6e67451dec..0d77cd6fd8d1 100644 --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -68,6 +68,9 @@ int dev_pm_set_wake_irq(struct device *dev, int irq) struct wake_irq *wirq; int err; + if (irq < 0) + return -EINVAL; + wirq = kzalloc(sizeof(*wirq), GFP_KERNEL); if (!wirq) return -ENOMEM; @@ -167,6 +170,9 @@ int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq) struct wake_irq *wirq; int err; + if (irq < 0) + return -EINVAL; + wirq = kzalloc(sizeof(*wirq), GFP_KERNEL); if (!wirq) return -ENOMEM; |