Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2655927pxj; Mon, 14 Jun 2021 04:10:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8xUe/Ds4ol86zwgxoRM3HV3F8zfOkCwVR9YrFTT28+r1BRl2AH7qlzYUs5Tgx9GRf6/ke X-Received: by 2002:a17:907:70d3:: with SMTP id yk19mr8211224ejb.450.1623669043390; Mon, 14 Jun 2021 04:10:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669043; cv=none; d=google.com; s=arc-20160816; b=Y1nGN5HzLNxMlAdtqT62Caa3eKLckZJvc0o7Lo5qbrFXJW2qMLOoGEGR8b8DglhsM+ dYjF7we4ebzm0viHBTzhRyCO7kGYdd+O9STGHoGSsuZDy5/Zj2AuqpXTtXVPsO7XDPET a92fR8wT7JUUqoD5vuiGli5EVoCVvjG+CslBfItb1CPit9xNAP3OpehIoc2NV172Bd9J Xo//pbZPnrZcWT+FrWf9Jt7eUy6phRVe4kqHHi9eaOm8X5RXqqhv25hHZiE8c5bL07AW fR+zWXWe664ZBc9cXsq+inA6RyWMHRL/PyGJcX3eRddxEueCcVt4+hENjjXBIGEEg9KD GPbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jp5kvoaXAackc/uDAxW2TLBnMJPkGkXrIkVUkdwreKo=; b=CppO0nu8zN73G7VdIVpD53QImasaOeT4/dQwts1lt21t2a+nVhCNAjiUI8riyr1bnW qdPR9tf+/tW2TzSVRzV8AYEJyamvEWdqXbAruYrFgrgRaPBKf1YS3Imik9PFOlViMqw9 dU5iiGyRE7IVRnK9P8Zz3ngUs9colmujxzFveNORX1IT+Zt+9tNxb9fS8uP13iW1jzd+ vI1IlYNbVxjtUFBIy+X40VjV8gkgnnd/5uAQY5w+Mx9ximx5VZGNoQ1ZIbwwGJKv2z+y VjY84Pfc9+Rhd6CKpynDjOQeDk5JkuBAl9OKwafvwYXSCZyNGH4yec8ved71MRT2sS2y 9pow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hZ2DkqmY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si11185725ejs.333.2021.06.14.04.10.20; Mon, 14 Jun 2021 04:10:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hZ2DkqmY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235574AbhFNLKp (ORCPT + 99 others); Mon, 14 Jun 2021 07:10:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:36770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234829AbhFNK7R (ORCPT ); Mon, 14 Jun 2021 06:59:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 426B561431; Mon, 14 Jun 2021 10:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667336; bh=9DsQAlrXIIkKDZkN+WHC7MUMFp4igyRwhLat0llSGY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZ2DkqmY9G0gq2icMBArsze8U7S3D1fo4pV2yLmr2wB8JKbjRkVJpk9ga4dWaJY6g Jp7uKnZP1EgkBsn3nYM5zHhB+Wug/a2vnUXx4XyDVPJE2vlO80ocCn2lCm2vaMvhl3 VKjqgvhTBBQ/JX+FiecGLopkY0aaJFvP3ZWyExWM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saubhik Mukherjee , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 031/131] net: appletalk: cops: Fix data race in cops_probe1 Date: Mon, 14 Jun 2021 12:26:32 +0200 Message-Id: <20210614102654.070736168@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Saubhik Mukherjee [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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