[PATCH] 2.4 make hpzx1 fake pci device safer

From: Alex Williamson <alex.williamson_at_hp.com>
Date: 2003-11-20 03:30:39
   The fake PCI devices created in the 2.4 zx1 machvec provide PCI-like
config space access to the chipset.  However, there are some registers
in there that have side effects that you don't just want to stumble
across.  These are all out beyond the configuration header space, so
nothing should rely on them.  This patch prevents access to the
dangerous one that you'd touch looking through /proc/bus/pci.  You can
probably still shoot yourself in the foot, but you shouldn't be able to
do it by reading through the proc files.  2.6 has removed these fake
devices, so the patch is not applicable.  Thanks,

	Alex

-- 
Alex Williamson                             HP Linux & Open Source Lab

===== arch/ia64/hp/zx1/hpzx1_misc.c 1.7 vs edited =====
--- 1.7/arch/ia64/hp/zx1/hpzx1_misc.c	Thu Oct 16 15:56:24 2003
+++ edited/arch/ia64/hp/zx1/hpzx1_misc.c	Wed Nov 19 09:16:57 2003
@@ -50,7 +50,14 @@
 		fake_dev->sizing = 0; \
 		return PCIBIOS_SUCCESSFUL; \
 	} \
-	*value = read##sz(fake_dev->mapped_csrs + where); \
+	switch (where & ~0x7) { \
+		case 0x48: /* initiates config cycles */ \
+		case 0x78: /* elroy suspend mode register */ \
+			*value = 0; \
+			break; \
+		default: \
+			*value = read##sz(fake_dev->mapped_csrs + where); \
+	} \
 	if (where == PCI_COMMAND) \
 		*value |= PCI_COMMAND_MEMORY; /* SBA omits this */ \
 	return PCIBIOS_SUCCESSFUL; \
@@ -68,8 +75,14 @@
 		if (value == (u##bits) ~0) \
 			fake_dev->sizing = 1; \
 		return PCIBIOS_SUCCESSFUL; \
-	} else \
-		write##sz(value, fake_dev->mapped_csrs + where); \
+	} \
+	switch (where & ~0x7) { \
+		case 0x48: /* initiates config cycles */ \
+		case 0x78: /* elroy suspend mode register */ \
+			break; \
+		default: \
+			write##sz(value, fake_dev->mapped_csrs + where); \
+	} \
 	return PCIBIOS_SUCCESSFUL; \
 }
 


-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Nov 19 11:30:55 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:20 EST