From patchwork Fri Jan 18 11:42:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 2001151 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C028CDF280 for ; Fri, 18 Jan 2013 11:43:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754008Ab3ARLmd (ORCPT ); Fri, 18 Jan 2013 06:42:33 -0500 Received: from mail-lb0-f181.google.com ([209.85.217.181]:34347 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753846Ab3ARLma (ORCPT ); Fri, 18 Jan 2013 06:42:30 -0500 Received: by mail-lb0-f181.google.com with SMTP id ge1so2610880lbb.40 for ; Fri, 18 Jan 2013 03:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=XvZRjcZUEKud5PL7HRYMbGuph9bZda2K1HSvr7X/Hrk=; b=EUGkuY7z1o1ndV/BFX9Lt3eQwU0Xgo2XlHAs01v140WZKEKgxtBeb9AvQ36zFMNCjd vdHgh3kQclSlCMxFgtR/wS/PuBw+GjOoXSSq+69RRHdoNTQSyX4JGpKilcz/elEzE5dT KybiPqNEPJd2Ua/nWcYcrQ2NqAKykhw1J6AdfRJIg3urF4rTs6OowLhDScvvqkIRL3E3 KN3Oj+mOjLY5B6VZIJ4djwHYq2wKW8C3KhwkvlhpTM9SUXmNNj7oMoHyKOk9RRpAG/UD jT0DVLLNcmLefuxNJKeeCvR5/icZ3Jxi7dqEvA2GCCfpnHrfOOgxUheWRK74G8x9MB/j UT8w== X-Received: by 10.112.86.232 with SMTP id s8mr3623907lbz.86.1358509349066; Fri, 18 Jan 2013 03:42:29 -0800 (PST) Received: from localhost (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPS id f8sm1988116lbg.2.2013.01.18.03.42.27 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Jan 2013 03:42:28 -0800 (PST) Subject: [PATCH 4/5] PCI: don't touch enable_cnt in pci_device_shutdown() To: linux-kernel@vger.kernel.org From: Konstantin Khlebnikov Cc: e1000-devel@lists.sourceforge.net, linux-pci@vger.kernel.org, Bjorn Helgaas , Khalid Aziz Date: Fri, 18 Jan 2013 15:42:26 +0400 Message-ID: <20130118114225.6698.42016.stgit@zurg> In-Reply-To: <20130118113019.6698.25941.stgit@zurg> References: <20130118113019.6698.25941.stgit@zurg> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org comment in commit b566a22c23327f18ce941ffad0ca907e50a53d41 ("PCI: disable Bus Master on PCI device shutdown") says: | Disable Bus Master bit on the device in pci_device_shutdown() to ensure PCI | devices do not continue to DMA data after shutdown. This can cause memory | corruption in case of a kexec where the current kernel shuts down and | transfers control to a new kernel while a PCI device continues to DMA to | memory that does not belong to it any more in the new kernel. Seems like pci_clear_master() must be used here instead of pci_disable_device(), because it disables Bus Muster unconditionally and doesn't changes enable_cnt. Signed-off-by: Konstantin Khlebnikov Cc: linux-pci@vger.kernel.org Cc: Bjorn Helgaas Cc: Khalid Aziz --- drivers/pci/pci-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 030dbf0..853d605 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -392,7 +392,7 @@ static void pci_device_shutdown(struct device *dev) * Turn off Bus Master bit on the device to tell it to not * continue to do DMA */ - pci_disable_device(pci_dev); + pci_clear_master(pci_dev); } #ifdef CONFIG_PM