diff options
| author | Saubhik Mukherjee <saubhik.mukherjee@gmail.com> | 2021-05-24 19:07:12 +0530 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-16 11:54:58 +0200 |
| commit | 57372e2926fe4796a3c25b1448cb041d8cfa3c78 (patch) | |
| tree | a858d1d15a577c5a303aea662ce634e57a13c0ce | |
| parent | 91d25454ec8e7d0530e94c2b6f3e53a47a7f62a0 (diff) | |
| download | linux-57372e2926fe4796a3c25b1448cb041d8cfa3c78.tar.gz linux-57372e2926fe4796a3c25b1448cb041d8cfa3c78.tar.bz2 linux-57372e2926fe4796a3c25b1448cb041d8cfa3c78.zip | |
net: appletalk: cops: Fix data race in cops_probe1
[ Upstream commit a4dd4fc6105e54393d637450a11d4cddb5fabc4f ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/net/appletalk/cops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c index bb49f6e40a19..0a7889abf2b2 100644 --- a/drivers/net/appletalk/cops.c +++ b/drivers/net/appletalk/cops.c @@ -325,6 +325,8 @@ 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); @@ -332,8 +334,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) goto err_out; } - dev->base_addr = ioaddr; - lp = netdev_priv(dev); spin_lock_init(&lp->lock); |
