Skip to content

Commit

Permalink
net: appletalk: cops: Fix data race in cops_probe1
Browse files Browse the repository at this point in the history
In cops_probe1(), there is a write to dev->base_addr after requesting an
interrupt line and registering the interrupt handler cops_interrupt().
The handler might be called in parallel to handle an interrupt.
cops_interrupt() tries to read dev->base_addr leading to a potential
data race. So write to dev->base_addr before calling request_irq().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Saubhik Mukherjee <saubhik.mukherjee@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Saubhik Mukherjee authored and David S. Miller committed May 24, 2021
1 parent 93c5d74 commit a4dd4fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/appletalk/cops.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
break;
}

dev->base_addr = ioaddr;

/* Reserve any actual interrupt. */
if (dev->irq) {
retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev);
if (retval)
goto err_out;
}

dev->base_addr = ioaddr;

lp = netdev_priv(dev);
spin_lock_init(&lp->lock);

Expand Down

0 comments on commit a4dd4fc

Please sign in to comment.