Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2632458pxj; Mon, 14 Jun 2021 03:34:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuGqob0tu1O3+Wng+JrtnOJOIPNR101MffsRrnmqc6knwJICgOqllpbDbwqjb7mUF7w5qA X-Received: by 2002:a17:906:8aa7:: with SMTP id mu39mr5886731ejc.400.1623666849615; Mon, 14 Jun 2021 03:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666849; cv=none; d=google.com; s=arc-20160816; b=HQAwtrfyMdGP2iBRpRrI1jjEkhCFC6UUhmhLBCMa3c/MtPR13QLo7wcc5Cr/gi/d4G vsqzBfxYHgdhEuSJ7y9IYSYtITcdQoJ8HcHQN2/H2Gt/UvM6RUlZEYLdNb1OJ02FXG8G XpkQjGLjF+koxegJ5Bq9N7S3xovF7mqrSfGB9Ul4D6HKMzw9oYe/p9g1tjMOEBkOlJ2/ aQ0Kq18pefknDp27777wMpUhLNXhViabr5FTCpa0SYT6SHtnjL/1ALGieCY54gvGI1I0 +5NB8cTKS9DhxY71gm183OjwDJ+G0New1yOAPPgDk4/ElJg6gYUIZZowlB93owCuVGLI D5vA== 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=Kq8Wiz+llcPaRn6qQEqpWmuPeBVRJ+lqUVqkEpIwzE4=; b=Sn/zsXo5jQNQkIBzgJ8z+k+v5XsppOX0I7jseo36Yav6Q5nDTY5xmKvm50jSkf4h94 b9zpJ5kPpT7kZ9fxtrRwZSXxY59HChxHY/naROlQoG9BcLW9w2WmmGDoANIjJe0atSRI 4sp9/WeJTyMXdad/E5eD6zayqQU8NHtVSKG+s1kMd24X6OxGgWp175759l5E86KuXDi4 pDnv8nP5SsGPsSsi2JhlPl0qAzajZVfkE2XYcNnjdqb5KK/SOeQ2Pr4FOFfQTBMNEYIh K+yXIitwC+MEHT8OnkCdKvHkj7w09Q+FuP3XRk0a/HhKqCkcGDTNrzB82nMbn9z6x50+ kysg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sjzhsfeW; 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 d4si11187279ejo.252.2021.06.14.03.33.47; Mon, 14 Jun 2021 03:34:09 -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=sjzhsfeW; 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 S232875AbhFNKeE (ORCPT + 99 others); Mon, 14 Jun 2021 06:34:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233077AbhFNKcb (ORCPT ); Mon, 14 Jun 2021 06:32:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61D4E611CA; Mon, 14 Jun 2021 10:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666613; bh=wsd71GWpjcCghhnVLpTuvODi+OFI3tJj2bsAKOT2WyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjzhsfeWwLsvzIk6Fm3+FN/kZysgLVoy4V02SwMOn2kJfGxFhydZPOxdMuGkoU4lF srtHj8ZiMMKDq6o73O1qjuHnGLw1l+nStT99PCDa85d5A3SSVU+RVJfNHQdqNMDoDr hXW6mW2SsTPH6VfFEW3BnnQersUQGWbB+AgTVL8A= 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 4.4 12/34] net: appletalk: cops: Fix data race in cops_probe1 Date: Mon, 14 Jun 2021 12:27:03 +0200 Message-Id: <20210614102641.986810199@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102641.582612289@linuxfoundation.org> References: <20210614102641.582612289@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 7f2a032c354c..841a5de58c7c 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