* [PATCH] net: appletalk: cops: Fix data race in cops_probe1
@ 2021-05-24 13:37 Saubhik Mukherjee
2021-05-24 21:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Saubhik Mukherjee @ 2021-05-24 13:37 UTC (permalink / raw)
To: davem, kuba, gustavoars, wanghai38
Cc: Saubhik Mukherjee, netdev, linux-kernel, ldv-project
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>
---
drivers/net/appletalk/cops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index ba8e70a8e312..6b12ce822e51 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -327,6 +327,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);
@@ -334,8 +336,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);
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: appletalk: cops: Fix data race in cops_probe1
2021-05-24 13:37 [PATCH] net: appletalk: cops: Fix data race in cops_probe1 Saubhik Mukherjee
@ 2021-05-24 21:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-24 21:10 UTC (permalink / raw)
To: Saubhik Mukherjee
Cc: davem, kuba, gustavoars, wanghai38, netdev, linux-kernel, ldv-project
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Mon, 24 May 2021 19:07:12 +0530 you wrote:
> 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).
>
> [...]
Here is the summary with links:
- net: appletalk: cops: Fix data race in cops_probe1
https://git.kernel.org/netdev/net/c/a4dd4fc6105e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-24 21:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 13:37 [PATCH] net: appletalk: cops: Fix data race in cops_probe1 Saubhik Mukherjee
2021-05-24 21:10 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.