Received: by 10.192.165.148 with SMTP id m20csp4364681imm; Tue, 8 May 2018 07:21:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpRKv12PP0eFAvZLIciy0EKlkqezMz5umCVMUPoTPgkWMQJbwcJdxMNgoQAPZI/J6aBNZV/ X-Received: by 10.98.232.1 with SMTP id c1mr40281699pfi.184.1525789274022; Tue, 08 May 2018 07:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525789273; cv=none; d=google.com; s=arc-20160816; b=Jn1IZCFROGxA5uK9xm0jwp192TMjnNz9WO+0RSLuiQ9LnIAHUXGfAyQ4CTYPV9JgXp oAPSqOWUvvuij9RnkN/uc6eIYcyKt1yErSYVuWqXfVuXvaOZ7kFF/UysXDsJB8hEi8Lu Wl6/GKfFWl1wBxdMg95nw6VYqG4sxfrsJ/0PeIDQj7C9dHjArHzBk3TLfJ2th8Ltwlfx 3vwsNICuHZqxcoiaKvXPH3Vjfht6/d1HqG2172bd2qtdO7qhUUK+zKhu5rrxVBw3mCyQ h1Dny1eW2SnJHUMlOn9qjN+4X4iAQgJbDvDJggZ4yo+ZQN6IZKL7Mkt0u6ARmro9v6Nd BHBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=gNFv77SEFJstty6bLvCNcamm50NASOG+9kttSN9KY7E=; b=TXkDZDBfKCMzC3Wpi4y+CdiYk+6gAx8MrnrxCOTCU66QfjZC6kP62FjGxrsSPK7Gjo coRphiZsxMOlA+sNe6oZrtWDoD4zIWN9xCX4k1I8B2kClqtRnL2jbK1rbs/BlcA0Nu6x /jTfQPIMRua3snfolUyFr+xYy2vDNuTNA2hSsq14yRScf6uQr9o4ljndRsyKSN/yHyTZ k7pl4oceXWlRdnfsFDtsjJKvqhUobLyuqr+mssuIPk5azSJSXGNsuHnv7KT1mTChIJpe 4zos0uBtQjNjer1ftpLH7UwJYQwbbBKJo1hrn1+lmsmxHRCNoyBjXJKOToqUiUZ1heKs KWVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QKEvW3Tm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2-v6si25204187plo.138.2018.05.08.07.20.58; Tue, 08 May 2018 07:21:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QKEvW3Tm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932381AbeEHOU3 (ORCPT + 99 others); Tue, 8 May 2018 10:20:29 -0400 Received: from mail-yb0-f175.google.com ([209.85.213.175]:43977 "EHLO mail-yb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932104AbeEHOU1 (ORCPT ); Tue, 8 May 2018 10:20:27 -0400 Received: by mail-yb0-f175.google.com with SMTP id v12-v6so2228401ybl.10; Tue, 08 May 2018 07:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gNFv77SEFJstty6bLvCNcamm50NASOG+9kttSN9KY7E=; b=QKEvW3Tm9+gvcW0ygf24sxFIDGV1aAxhW2/sw3UlSHZABrOJwjFH4oXZc/CwuC/izC Ze8CoM2cCIg6fxjmXna4IkKmhZOmykEdBWoHhNHQixRC3M30Yf+13KxuVDuefPqnQFV1 CgBEFgkzgWn9uuZ3xsY7J3FhFD2LGlKEYTJZA+EW9/15pZQ2pmo8P11VmNQR+jtyrbNR U8FGa+uHEijoGCCvqnAWt1QWtzbUbmAFzvqTtrFfNYtio6SgyLlFktrOWfuIOZ8W8kLw a6rV+811EOISTDVI+oizwzgM4iAliPMeON7V0eRKM9NlVtfK5fzvavOFtPLpkEXBI16a R+9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=gNFv77SEFJstty6bLvCNcamm50NASOG+9kttSN9KY7E=; b=JqgCwEw8fY4QZfufRMyTXeW01PPawT9B+BgUl33qF6/QG6m4G/F00WBSxQIrgFoIB+ /mYRPimWfu8hWK/tSk/7YxQWaHhVw3zHjiU/ip60cIcdTOqYTXKoyngeYw24WaiJqdC0 PAp4Ywh03Zm8PaR28CNpO1jc/tpxAJRI3K8iMGR93ChEqik9Jrpi/aJXrTzPZ1kerfnw ErpN46gWwYAOplRjqrGKo35XHiXXTF79r7HgeGILwvGlJGiASrTKvSOt5RQLw3wnXyNq MQdWH7Jm5iFfPBmAo83E9Lw4DVQLM2mc+YAp4QFvSWVRfRgH2Z4FBDt4REt4DP3VZWiQ pXLA== X-Gm-Message-State: ALQs6tAOIHipslZDERJ4XHClyQtf5JUeerVWmkO7gaaTgXDgfHl/lAFg pe/tE44C+hw5FwPodCoG4cw= X-Received: by 2002:a25:41c6:: with SMTP id o189-v6mr25292745yba.125.1525789226293; Tue, 08 May 2018 07:20:26 -0700 (PDT) Received: from localhost ([2620:10d:c091:200::6a99]) by smtp.gmail.com with ESMTPSA id n66-v6sm1054846ywd.95.2018.05.08.07.20.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 07:20:25 -0700 (PDT) Date: Tue, 8 May 2018 07:20:23 -0700 From: Tejun Heo To: Jia-Ju Bai Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ata: ata_piix: Fix a possible data race in piix_pci_device_resume Message-ID: <20180508142023.GJ2368884@devbig577.frc2.facebook.com> References: <20180508034613.12969-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180508034613.12969-1-baijiaju1990@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, May 08, 2018 at 11:46:13AM +0800, Jia-Ju Bai wrote: > The write operation to "host->flags" is protected by > the lock on line 1048, but the read operation to > this data on line 1046 is not protected by the lock. > Thus, there may exist a data race for "host->flags". > > To fix this data race, the read operation to "host->flags" > should be also protected by the lock. This isn't necessarily wrong. It isn't different from atomic bitops - the modifications are synchronized but what the reads get is determined by memory ordering or other synchronization. Here, the whole suspend / resume paths are always synchronized and the spinlocks are there just in case there are other writers to the field. Thanks. -- tejun