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: <DCOZIMAYLN8P.23PQEAFQ26ADZ@baylibre.com>
Date: Wed, 10 Sep 2025 10:41:28 +0200
From: "Markus Schneider-Pargmann" <msp@...libre.com>
To: "Marc Kleine-Budde" <mkl@...gutronix.de>, "Chandrasekar Ramakrishnan"
 <rcsekar@...sung.com>, "Vincent Mailhol" <mailhol.vincent@...adoo.fr>,
 "Patrik Flykt" <patrik.flykt@...ux.intel.com>, "Dong Aisheng"
 <b29396@...escale.com>, "Varka Bhadram" <varkabhadram@...il.com>, "Wu Bo"
 <wubo.oduw@...il.com>, "Philipp Zabel" <p.zabel@...gutronix.de>
Cc: <linux-can@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
 <kernel@...gutronix.de>
Subject: Re: [PATCH v2 2/7] can: m_can: only handle active interrupts

On Tue Sep 9, 2025 at 7:53 PM CEST, Marc Kleine-Budde wrote:
> The M_CAN IP core has an Interrupt Register (IR) and an Interrupt
> Enable (IE) register. An interrupt is triggered if at least 1 bit is
> set in the bitwise and of IR and IE.
>
> Depending on the configuration not all interrupts are enabled in the
> IE register. However the m_can_rx_handler() IRQ handler looks at all
> interrupts not just the enabled ones. This may lead to handling of not
> activated interrupts.
>
> Fix the problem and mask the irqstatus (IR register) with the
> active_interrupts (cached value of IE register).
>
> Fixes: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support")
> Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
> ---
>  drivers/net/can/m_can/m_can.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index fe74dbd2c966..16b38e6c3985 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -1057,6 +1057,7 @@ static int m_can_poll(struct napi_struct *napi, int quota)
>  	u32 irqstatus;
>  
>  	irqstatus = cdev->irqstatus | m_can_read(cdev, M_CAN_IR);
> +	irqstatus &= cdev->active_interrupts;
>  
>  	work_done = m_can_rx_handler(dev, quota, irqstatus);
>  
> @@ -1243,6 +1244,8 @@ static int m_can_interrupt_handler(struct m_can_classdev *cdev)
>  	}
>  
>  	m_can_coalescing_update(cdev, ir);
> +
> +	ir &= cdev->active_interrupts;

m_can_coalescing_update() can change active_interrupts, meaning the
interrupt that caused the interrupt handler to run may be disabled in
active_interrupts above and then masked in this added line. Would that
still work or does it confuse the hardware?

Best
Markus

>  	if (!ir)
>  		return IRQ_NONE;
>  


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ