summaryrefslogtreecommitdiff
path: root/drivers/base/power/wakeirq.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2015-11-12 10:26:57 -0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-11-16 23:10:20 +0100
commit6f9b36cd2497660e254c67ed131f0b297ed8bf40 (patch)
tree301a3d5ea54c58d364a5241d4fdc6dfac3d9f534 /drivers/base/power/wakeirq.c
parentd439e64f22ce0eea681ae90c71f584d3a0145ded (diff)
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/power/wakeirq.c')
-rw-r--r--drivers/base/power/wakeirq.c6
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;