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, 6 Mar 2007 09:46:38 -0700
From:	"Dale Farnsworth" <dale@...nsworth.org>
To:	akpm@...ux-foundation.org
Cc:	jeff@...zik.org, netdev@...r.kernel.org, giri@....cs.sunysb.edu,
	pgiri@...oo.com
Subject: Re: [patch 18/19] mv643xx ethernet driver IRQ registration fix

On Tue, Mar 06, 2007 at 02:42:02AM -0800, akpm@...ux-foundation.org wrote:
> From: Giridhar Pemmasani <giri@....cs.sunysb.edu>
> 
> During initialization, mv643xx driver registers IRQ before setting up tx/rx
> rings.  This causes kernel oops because mv643xx_poll, which gets called
> right after registering IRQ, calls netif_rx_complete, which accesses the rx
> ring (I don't have the oops message anymore; I just remember this sequence
> of calls).  Attached (tested) patch first initializes the rx/tx rings and
> then registers the IRQ.

I believe a better fix is to disable any pending interrupt sources
before calling request_irq().  I sent the patch below to Giri for
confirmation, but haven't heard back.  I should've copied Andrew.

Giri, have you had a chance to test this alternative patch?

Thanks,
-Dale

> Date: Fri, 2 Mar 2007 17:03:53 -0700
> To: Giridhar Pemmasani <giri@....cs.sunysb.edu>
> Message-ID: <20070303000353.GA1022@...zy.farnsworth.org>
> In-Reply-To: <es8ahm$64p$1@....gmane.org>
> 
> On Fri, Mar 02, 2007 at 04:52:06AM +0000, Giridhar Pemmasani wrote:
> > During initialization, mv643xx driver registers IRQ before setting up tx/rx
> > rings. This causes kernel oops because mv643xx_poll, which gets called
> > right after registering IRQ, calls netif_rx_complete, which accesses the rx
> > ring (I don't have the oops message anymore; I just remember this sequence
> > of calls). Attached (tested) patch first initializes the rx/tx rings and
> > then registers the IRQ.
> > 
> > Giri
> > 
> > Signed-off-by: Giridhar Pemmasani <pgiri@...oo.com>
> 
> Giridhar, does the following patch fix your problem, in place of the
> patch you supplied?
> 
> -Dale

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 3e045a6..192b390 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -787,6 +787,12 @@ static int mv643xx_eth_open(struct net_device *dev)
 	unsigned int size;
 	int err;
 
+	/* Clear any pending ethernet port interrupts */
+	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0);
+	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
+	/* wait for previous write to complete */
+	mv_read (MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num));
+
 	err = request_irq(dev->irq, mv643xx_eth_int_handler,
 			IRQF_SHARED | IRQF_SAMPLE_RANDOM, dev->name, dev);
 	if (err) {
@@ -875,10 +881,6 @@ static int mv643xx_eth_open(struct net_device *dev)
 
 	mv643xx_eth_rx_refill_descs(dev);	/* Fill RX ring with skb's */
 
-	/* Clear any pending ethernet port interrupts */
-	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num), 0);
-	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
-
 	eth_port_start(dev);
 
 	/* Interrupt Coalescing */

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ