[kernel/f16] Fix divide-by-zero in nouveau driver (rhbz #747129)

Chuck Ebbert cebbert at fedoraproject.org
Wed Oct 19 04:38:54 UTC 2011


commit 5cfb71ce9c1b7de54c03cf9f0ae59ada59728fe7
Author: Chuck Ebbert <cebbert at redhat.com>
Date:   Wed Oct 19 00:39:47 2011 -0400

    Fix divide-by-zero in nouveau driver (rhbz #747129)

 drm-nouveau-updates-fix-nv40-pm.patch |   24 ++++++++++++++++++++++++
 kernel.spec                           |    7 +++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/drm-nouveau-updates-fix-nv40-pm.patch b/drm-nouveau-updates-fix-nv40-pm.patch
new file mode 100644
index 0000000..16adf20
--- /dev/null
+++ b/drm-nouveau-updates-fix-nv40-pm.patch
@@ -0,0 +1,24 @@
+diff --git a/drivers/gpu/drm/nouveau/nv40_pm.c b/drivers/gpu/drm/nouveau/nv40_pm.c
+index 9b5cbb4..73dfdff 100644
+--- a/drivers/gpu/drm/nouveau/nv40_pm.c
++++ b/drivers/gpu/drm/nouveau/nv40_pm.c
+@@ -57,12 +57,14 @@ read_pll_2(struct drm_device *dev, u32 reg)
+ 	int P = (ctrl & 0x00070000) >> 16;
+ 	u32 ref = 27000, clk = 0;
+ 
+-	if (ctrl & 0x80000000)
++	if ((ctrl & 0x80000000) && M1) {
+ 		clk = ref * N1 / M1;
+-
+-	if (!(ctrl & 0x00000100)) {
+-		if (ctrl & 0x40000000)
+-			clk = clk * N2 / M2;
++		if ((ctrl & 0x40000100) == 0x40000000) {
++			if (M2)
++				clk = clk * N2 / M2;
++			else
++				clk = 0;
++		}
+ 	}
+ 
+ 	return clk >> P;
diff --git a/kernel.spec b/kernel.spec
index f9167ba..4613f7e 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -680,6 +680,8 @@ Patch1500: fix_xen_guest_on_old_EC2.patch
 
 # nouveau + drm fixes
 Patch1810: drm-nouveau-updates.patch
+# fix divide by zero (rhbz #747129)
+Patch1811: drm-nouveau-updates-fix-nv40-pm.patch
 # intel drm is all merged upstream
 Patch1824: drm-intel-next.patch
 # make sure the lvds comes back on lid open
@@ -1320,6 +1322,8 @@ ApplyPatch fix_xen_guest_on_old_EC2.patch
 
 # Nouveau DRM
 ApplyOptionalPatch drm-nouveau-updates.patch
+# fix divide by zero (rhbz #747129)
+ApplyPatch drm-nouveau-updates-fix-nv40-pm.patch
 
 # Intel DRM
 ApplyOptionalPatch drm-intel-next.patch
@@ -2084,6 +2088,9 @@ fi
 # and build.
 
 %changelog
+* Wed Oct 19 2011 Chuck Ebbert <cebbert at redhat.com> 3.1.0-0.rc10.git0.1
+- Fix divide-by-zero in nouveau driver (rhbz #747129)
+
 * Tue Oct 18 2011 Chuck Ebbert <cebbert at redhat.com>
 - Fix lock inversion causing hangs in 3.1-rc9 (rhbz #746485)
 - Linux 3.1-rc10


More information about the scm-commits mailing list