linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Saubhik Mukherjee <saubhik.mukherjee@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 14/18] net: appletalk: cops: Fix data race in cops_probe1
Date: Thu,  3 Jun 2021 13:10:25 -0400	[thread overview]
Message-ID: <20210603171029.3169669-14-sashal@kernel.org> (raw)
In-Reply-To: <20210603171029.3169669-1-sashal@kernel.org>

From: Saubhik Mukherjee <saubhik.mukherjee@gmail.com>

[ 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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/appletalk/cops.c b/drivers/net/appletalk/cops.c
index 486e1e6997fc..dde0cda3f696 100644
--- a/drivers/net/appletalk/cops.c
+++ b/drivers/net/appletalk/cops.c
@@ -324,6 +324,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);
@@ -331,8 +333,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


  parent reply	other threads:[~2021-06-03 17:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 17:10 [PATCH AUTOSEL 4.14 01/18] spi: Fix spi device unregister flow Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 02/18] net/nfc/rawsock.c: fix a permission check bug Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 03/18] ASoC: sti-sas: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 04/18] isdn: mISDN: netjet: Fix crash in nj_probe: Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 05/18] bonding: init notify_work earlier to avoid uninitialized use Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 06/18] netlink: disable IRQs for netlink_lock_table() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 07/18] net: mdiobus: get rid of a BUG_ON() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 08/18] cgroup: disable controllers at parse time Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 09/18] wq: handle VM suspension in stall detection Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 10/18] net/qla3xxx: fix schedule while atomic in ql_sem_spinlock Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 11/18] scsi: vmw_pvscsi: Set correct residual data length Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 12/18] scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 13/18] net: macb: ensure the device is available before accessing GEMGXL control registers Sasha Levin
2021-06-03 17:10 ` Sasha Levin [this message]
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 15/18] MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 16/18] bnx2x: Fix missing error code in bnx2x_iov_init_one() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 17/18] powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 18/18] powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 " Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210603171029.3169669-14-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saubhik.mukherjee@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).