Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1199/?format=api
{ "id": 1199, "url": "http://patchwork.ozlabs.org/api/patches/1199/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20080923224535.6869.76210.stgit@jtkirshe-mobile.jf.intel.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20080923224535.6869.76210.stgit@jtkirshe-mobile.jf.intel.com>", "list_archive_url": null, "date": "2008-09-23T22:45:54", "name": "[2/3] e1000e: Useset_memory_ro()/set_memory_rw() to protect flash memory", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": true, "hash": "d7bfa98eabe774e5fde07c569aa70963a2b30946", "submitter": { "id": 473, "url": "http://patchwork.ozlabs.org/api/people/473/?format=api", "name": "Kirsher, Jeffrey T", "email": "jeffrey.t.kirsher@intel.com" }, "delegate": { "id": 36, "url": "http://patchwork.ozlabs.org/api/users/36/?format=api", "username": "jgarzik", "first_name": "Jeff", "last_name": "Garzik", "email": "jgarzik@pobox.com" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20080923224535.6869.76210.stgit@jtkirshe-mobile.jf.intel.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/1199/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1199/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 5A726DDDE3\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 24 Sep 2008 08:45:56 +1000 (EST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751357AbYIWWpv (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 23 Sep 2008 18:45:51 -0400", "(majordomo@vger.kernel.org) by vger.kernel.org id S1751421AbYIWWpv\n\t(ORCPT <rfc822; netdev-outgoing>); Tue, 23 Sep 2008 18:45:51 -0400", "from rv-out-0506.google.com ([209.85.198.231]:54041 \"EHLO\n\trv-out-0506.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751005AbYIWWpt (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Tue, 23 Sep 2008 18:45:49 -0400", "by rv-out-0506.google.com with SMTP id k40so2390225rvb.1\n\tfor <netdev@vger.kernel.org>; Tue, 23 Sep 2008 15:45:49 -0700 (PDT)", "by 10.141.201.1 with SMTP id d1mr3048501rvq.117.1222209949103;\n\tTue, 23 Sep 2008 15:45:49 -0700 (PDT)", "from jtkirshe-mobile.jf.intel.com\n\t(c-76-115-105-25.hsd1.or.comcast.net [76.115.105.25])\n\tby mx.google.com with ESMTPS id f21sm2702455rvb.5.2008.09.23.15.45.48\n\t(version=TLSv1/SSLv3 cipher=RC4-MD5);\n\tTue, 23 Sep 2008 15:45:48 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\n\th=domainkey-signature:received:received:from:subject:to:cc:date\n\t:message-id:user-agent:mime-version:content-type\n\t:content-transfer-encoding:sender;\n\tbh=duVVZU5TzpZucVgTnvdYVV4Sa6sbMDMWrPWksWwi7Es=;\n\tb=mcv6qvy/10dqKBn/fTOmHC4jm8lArvL0PH2zbJgAxvU/+783io/wWypmaePWGI3ar/\n\tu8bNqGB+sCqKNSNDhUeRC14TdSdMbSt0SYTa0AxX3ss9YT4roL1ce1pZ3USyG9Wxz5hL\n\tWz2VlrEnqCKlMLcpjOYWvDjjYusi/LQAY7PH4=", "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\n\th=from:subject:to:cc:date:message-id:user-agent:mime-version\n\t:content-type:content-transfer-encoding:sender;\n\tb=QFcXJ3k/EOC965ADl8/eLyahEK3zsmuXKo7TN3J7jSXMrPTAxS89JF2xV9eA7uMobn\n\tRq4+7sL1ycXgH6aFHAXuDLVbUoY+OfTap/Eq8fBc5LO+Tl/xkbpLBAgWnFWW0z0MA93/\n\t4H/H5OdSdjIUHNLlFtCR128Ztf7jMKlM+KWQQ=", "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>", "Subject": "[PATCH 2/3] e1000e: Useset_memory_ro()/set_memory_rw() to protect\n\tflash memory", "To": "jeff@garzik.org, mingo@elte.hu, davem@davemloft.net", "Cc": "netdev@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tjesse.brandeburg@intel.com, john.ronciak@intel.com,\n\tBruce Allan <bruce.w.allan@intel.com>,\n\tJeff Kirsher <jeffrey.t.kirsher@intel.com>", "Date": "Tue, 23 Sep 2008 15:45:54 -0700", "Message-ID": "<20080923224535.6869.76210.stgit@jtkirshe-mobile.jf.intel.com>", "User-Agent": "StGIT/0.14.3", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "From: Bruce Allan <bruce.w.allan@intel.com>\n\nA number of users have reported NVM corruption on various ICHx platform\nLOMs. One possible reasons for this could be unexpected and/or malicious\nwrites to the flash memory area mapped into kernel memory. Once the\ninterface is up, there should be very few reads/writes of the mapped flash\nmemory. This patch makes use of the x86 set_memory_*() functions to set\nthe mapped memory read-only and temporarily set it writable only when the\ndriver needs to write to it. With the memory set read-only, any unexpected\nwrite will be logged with a stack dump indicating the offending code.\n\nSince these LOMs are only on x86 ICHx platforms, it does not matter that\nthis API is not yet available on other architectures, however it is\ndependent on a previous patch that exports these function name symbols.\n\nSigned-off-by: Bruce Allan <bruce.w.allan@intel.com>\nSigned-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>\n---\n\n drivers/net/e1000e/e1000.h | 1 +\n drivers/net/e1000e/hw.h | 1 +\n drivers/net/e1000e/ich8lan.c | 16 ++++++++++++++++\n drivers/net/e1000e/netdev.c | 11 +++++++----\n 4 files changed, 25 insertions(+), 4 deletions(-)\n\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe netdev\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at http://vger.kernel.org/majordomo-info.html", "diff": "diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h\nindex ac4e506..2786754 100644\n--- a/drivers/net/e1000e/e1000.h\n+++ b/drivers/net/e1000e/e1000.h\n@@ -36,6 +36,7 @@\n #include <linux/workqueue.h>\n #include <linux/io.h>\n #include <linux/netdevice.h>\n+#include <asm/cacheflush.h>\n \n #include \"hw.h\"\n \ndiff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h\nindex 74f263a..dd25009 100644\n--- a/drivers/net/e1000e/hw.h\n+++ b/drivers/net/e1000e/hw.h\n@@ -863,6 +863,7 @@ struct e1000_hw {\n \n \tu8 __iomem *hw_addr;\n \tu8 __iomem *flash_address;\n+\tresource_size_t flash_len;\n \n \tstruct e1000_mac_info mac;\n \tstruct e1000_fc_info fc;\ndiff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c\nindex 9e38452..f47c60e 100644\n--- a/drivers/net/e1000e/ich8lan.c\n+++ b/drivers/net/e1000e/ich8lan.c\n@@ -176,12 +176,28 @@ static inline u32 __er32flash(struct e1000_hw *hw, unsigned long reg)\n \n static inline void __ew16flash(struct e1000_hw *hw, unsigned long reg, u16 val)\n {\n+#ifdef _ASM_X86_CACHEFLUSH_H\n+\tset_memory_rw((unsigned long)hw->flash_address,\n+\t hw->flash_len >> PAGE_SHIFT);\n+#endif\n \twritew(val, hw->flash_address + reg);\n+#ifdef _ASM_X86_CACHEFLUSH_H\n+\tset_memory_ro((unsigned long)hw->flash_address,\n+\t hw->flash_len >> PAGE_SHIFT);\n+#endif\n }\n \n static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val)\n {\n+#ifdef _ASM_X86_CACHEFLUSH_H\n+\tset_memory_rw((unsigned long)hw->flash_address,\n+\t hw->flash_len >> PAGE_SHIFT);\n+#endif\n \twritel(val, hw->flash_address + reg);\n+#ifdef _ASM_X86_CACHEFLUSH_H\n+\tset_memory_ro((unsigned long)hw->flash_address,\n+\t hw->flash_len >> PAGE_SHIFT);\n+#endif\n }\n \n #define er16flash(reg)\t\t__er16flash(hw, (reg))\ndiff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c\nindex d266510..0e51841 100644\n--- a/drivers/net/e1000e/netdev.c\n+++ b/drivers/net/e1000e/netdev.c\n@@ -4364,7 +4364,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,\n \tstruct e1000_hw *hw;\n \tconst struct e1000_info *ei = e1000_info_tbl[ent->driver_data];\n \tresource_size_t mmio_start, mmio_len;\n-\tresource_size_t flash_start, flash_len;\n \n \tstatic int cards_found;\n \tint i, err, pci_using_dac;\n@@ -4434,11 +4433,15 @@ static int __devinit e1000_probe(struct pci_dev *pdev,\n \n \tif ((adapter->flags & FLAG_HAS_FLASH) &&\n \t (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {\n-\t\tflash_start = pci_resource_start(pdev, 1);\n-\t\tflash_len = pci_resource_len(pdev, 1);\n-\t\tadapter->hw.flash_address = ioremap(flash_start, flash_len);\n+\t\tadapter->hw.flash_len = pci_resource_len(pdev, 1);\n+\t\tadapter->hw.flash_address = ioremap(pci_resource_start(pdev, 1),\n+\t\t adapter->hw.flash_len);\n \t\tif (!adapter->hw.flash_address)\n \t\t\tgoto err_flashmap;\n+#ifdef _ASM_X86_CACHEFLUSH_H\n+\t\tset_memory_ro((unsigned long)adapter->hw.flash_address,\n+\t\t adapter->hw.flash_len >> PAGE_SHIFT);\n+#endif\n \t}\n \n \t/* construct the net_device struct */\n", "prefixes": [ "2/3" ] }