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]
Date:	Tue, 15 Jul 2014 15:57:46 +0200
From:	Marc Kleine-Budde <mkl@...gutronix.de>
To:	Lothar Waßmann <LW@...O-electronics.de>,
	Stefan Agner <stefan@...er.ch>
CC:	shawn.guo@...escale.com, linux-arm-kernel@...ts.infradead.org,
	kernel@...gutronix.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/4] can: flexcan: switch on clocks before accessing
 ecr register

On 07/15/2014 03:54 PM, Lothar Waßmann wrote:
> Hi,
> 
> Stefan Agner wrote:
>> Reported-by: Ashutosh Singh <ashuleapyear@...il.com>
>> Suggested-by: Marc Kleine-Budde <mkl@...gutronix.de>
>> [stefan@...er.ch: added return check for clk_enable_prepare]
>>
>> Signed-off-by: Stefan Agner <stefan@...er.ch>
>> ---
>>  drivers/net/can/flexcan.c | 18 ++++++++++++++++--
>>  1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
>> index f425ec2..89745aa 100644
>> --- a/drivers/net/can/flexcan.c
>> +++ b/drivers/net/can/flexcan.c
>> @@ -383,12 +383,26 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
>>  {
>>  	const struct flexcan_priv *priv = netdev_priv(dev);
>>  	struct flexcan_regs __iomem *regs = priv->base;
>> -	u32 reg = flexcan_read(&regs->ecr);
>> +	u32 reg, err;
>> +
>> +	err = clk_prepare_enable(priv->clk_ipg);
>> +	if (err)
>> +		return err;
>> +
>> +	err = clk_prepare_enable(priv->clk_per);
>> +	if (err)
>> +		goto out_disable_ipg;
>> +
>> +	reg = flexcan_read(&regs->ecr);
>>  
> flexcan_get_berr_counter() may be called from interrupt context and
> thus must not call any functions that can sleep.
> Compiling the driver with CONFIG_DEBUG_ATOMIC_SLEEP would catch this!

It's called from the NAPI softirq. I'll prepare a patch.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ