rpms/kernel/F-9 linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch, NONE, 1.1 kernel.spec, 1.772, 1.773

Chuck Ebbert cebbert at fedoraproject.org
Tue Sep 23 00:52:20 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12575

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch 
Log Message:
pcmcia: Fix broken abuse of dev->driver_data (#462178)

linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch:

--- NEW FILE linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch ---
From: Alan Cox <alan at redhat.com>
Date: Mon, 22 Sep 2008 14:58:14 +0000 (+0100)
Subject: pcmcia: Fix broken abuse of dev->driver_data
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=cec5eb7be3a104fffd27ca967ee8e15a123050e2

pcmcia: Fix broken abuse of dev->driver_data

PCMCIA abuses dev->private_data in the probe methods. Unfortunately it
continues to abuse it after calling drv->probe() which leads to crashes and
other nasties (such as bogus probes of multifunction devices) giving errors like

pcmcia: registering new device pcmcia0.1
kernel: 0.1: GetNextTuple: No more items

Extract the passed data before calling the driver probe function that way
we don't blow up when the driver reuses dev->private_data as its right.

As its close to the final release just move the hack so it works out,
hopefully someone will be sufficiently embarrassed to produce a nice rework
for 2.6.28.

Signed-off-by: Alan Cox <alan at redhat.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
BZ 462178

diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 4174d96..34c83d3 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -427,6 +427,18 @@ static int pcmcia_device_probe(struct device * dev)
 	p_drv = to_pcmcia_drv(dev->driver);
 	s = p_dev->socket;
 
+	/* The PCMCIA code passes the match data in via dev->driver_data
+	 * which is an ugly hack. Once the driver probe is called it may
+	 * and often will overwrite the match data so we must save it first
+	 *
+	 * handle pseudo multifunction devices:
+	 * there are at most two pseudo multifunction devices.
+	 * if we're matching against the first, schedule a
+	 * call which will then check whether there are two
+	 * pseudo devices, and if not, add the second one.
+	 */
+	did = p_dev->dev.driver_data;
+
 	ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id,
 	       p_drv->drv.name);
 
@@ -455,21 +467,14 @@ static int pcmcia_device_probe(struct device * dev)
 		goto put_module;
 	}
 
-	/* handle pseudo multifunction devices:
-	 * there are at most two pseudo multifunction devices.
-	 * if we're matching against the first, schedule a
-	 * call which will then check whether there are two
-	 * pseudo devices, and if not, add the second one.
-	 */
-	did = p_dev->dev.driver_data;
 	if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
 	    (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
 		pcmcia_add_device_later(p_dev->socket, 0);
 
- put_module:
+put_module:
 	if (ret)
 		module_put(p_drv->owner);
- put_dev:
+put_dev:
 	if (ret)
 		put_device(dev);
 	return (ret);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.772
retrieving revision 1.773
diff -u -r1.772 -r1.773
--- kernel.spec	20 Sep 2008 07:04:43 -0000	1.772
+++ kernel.spec	23 Sep 2008 00:51:50 -0000	1.773
@@ -699,6 +699,7 @@
 
 Patch2700: linux-2.6-intel-msr-backport.patch
 Patch2701: linux-2.6-libata-sff-kill-spurious-WARN_ON-in-ata_hsm_move.patch
+Patch2703: linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1291,6 +1292,8 @@
 
 ApplyPatch linux-2.6-intel-msr-backport.patch
 ApplyPatch linux-2.6-libata-sff-kill-spurious-WARN_ON-in-ata_hsm_move.patch
+# fix subtle but annoying PCMCIA bug
+ApplyPatch linux-2.6-pcmcia-fix-broken-abuse-of-dev-driver_data.patch
 # ---------- below all scheduled for 2.6.24 -----------------
 
 # END OF PATCH APPLICATIONS
@@ -1882,6 +1885,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Mon Sep 22 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-46
+- pcmcia: Fix broken abuse of dev->driver_data (#462178)
+
 * Fri Sep 19 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-45
 - pci: three patches to disable PCIe ASPM on old devices/systems (#462210)
 




More information about the fedora-extras-commits mailing list