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: <20130607190206.GC15295@arwen.pp.htv.fi>
Date:	Fri, 7 Jun 2013 22:02:06 +0300
From:	Felipe Balbi <balbi@...com>
To:	Grygorii Strashko <grygorii.strashko@...com>
CC:	Wolfram Sang <wsa@...-dreams.de>, Tony Lindgren <tony@...mide.com>,
	<linux-kernel@...r.kernel.org>, <linux-omap@...r.kernel.org>,
	<linux-i2c@...r.kernel.org>, Kevin Hilman <khilman@...aro.org>
Subject: Re: [PATCH 2/5] i2c: omap: add runtime check in isr to be sure that
 i2c is enabled

Hi,

On Fri, Jun 07, 2013 at 09:46:05PM +0300, Grygorii Strashko wrote:
> Add runtime check at the beginning of omap_i2c_isr/omap_i2c_isr_thread
> to be sure that i2c is enabled, before performing IRQ handling and accessing
> I2C IP registers:
> 	if (pm_runtime_suspended(dev->dev)) {
> 		WARN_ONCE(true, "We should never be here!\n");
> 		return IRQ_NONE;
> 	}
> 
> Produce warning in case if ISR called when i2c is disabled
> 
> CC: Kevin Hilman <khilman@...aro.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@...com>
> ---
>  drivers/i2c/busses/i2c-omap.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 97844ff..2dac598 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -885,6 +885,11 @@ omap_i2c_isr(int irq, void *dev_id)
>  	u16 stat;
>  
>  	spin_lock(&dev->lock);
> +	if (pm_runtime_suspended(dev->dev)) {
> +		WARN_ONCE(true, "We should never be here!\n");
> +		return IRQ_NONE;
> +	}

returning IRQ_NONE is not what you want to do in this case. You want to
setup a flag so that your runtime_resume() knows that there are pending
events to be handled and you handle those in runtime_resume time.

But to be frank, I don't see how this can trigger since we're calling
pm_runtime_get_sync() from omap_i2c_xfer() which means by the time
pm_runtime_get_sync() returns, assuming no errors, i2c module should be
fully resumed and ready to go. Perhaps you have found a bug somewhere
else ?

Also, your 'We should never be here' message isn't helpfull at all.

> @@ -905,6 +910,11 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
>  	u16 stat;
>  	int err = 0, count = 0;
>  
> +	if (pm_runtime_suspended(dev->dev)) {
> +		WARN_ONCE(true, "We should never be here!\n");
> +		return IRQ_NONE;
> +	}

because of IRQF_ONESHOT I can't see how this would *ever* be a valid
check.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ