net: appletalk: cops: Fix data race in cops_probe1
authorSaubhik Mukherjee <saubhik.mukherjee@gmail.com>
Mon, 24 May 2021 13:37:12 +0000 (19:07 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jun 2021 10:01:37 +0000 (12:01 +0200)
commitee144b79802849626f8fd83ab5929e7e8118ff6b
treec246e21f1511d3fa55dc645b3bba3af62736fe79
parenta385cbf31ed0deceb2e09c3950b605f94c9a4f0a
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>
drivers/net/appletalk/cops.c