lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151112185211.GB8494@dtor-ws>
Date:	Thu, 12 Nov 2015 10:52:11 -0800
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Grygorii Strashko <grygorii.strashko@...com>
Cc:	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Tony Lindgren <tony@...mide.com>, linux-pm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] PM / wakeirq: check that wake IRQ is valid before
 accepting it

On Thu, Nov 12, 2015 at 08:41:55PM +0200, Grygorii Strashko wrote:
> On 11/12/2015 08:26 PM, Dmitry Torokhov wrote:
> >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@...il.com>
> >---
> >
> >My recent change to i2c core introduced a code path that led to calling
> >dev_pm_set_wake_irq(&client->dev, -ENOENT), which succeeded but
> >obviously did the wrong thing. Checking the IRQ and bailing out early
> >would have helped noticing this issue earlier.
> >
> >  drivers/base/power/wakeirq.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> >diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c
> >index eb6e674..0d77cd6 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)
> 
> <= 0 ?

Maybe. I am still confused whether we treat 0 as invalid or not.

> 
> >+		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;
> >
> 
> 
> -- 
> regards,
> -grygorii

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ