aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ps3/patches-2.6.28/0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch
diff options
context:
space:
mode:
authorHamish Guthrie <hcg@openwrt.org>2009-03-24 08:54:41 +0000
committerHamish Guthrie <hcg@openwrt.org>2009-03-24 08:54:41 +0000
commit74b20050069bf139ff490f32435f27b927fb4ce7 (patch)
treec1cc6c53bf0a0eb89ebaf60d02359b15334b3e28 /target/linux/ps3/patches-2.6.28/0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch
parentd0e357e729480d44369c2472081a587e4e5c5e12 (diff)
downloadupstream-74b20050069bf139ff490f32435f27b927fb4ce7.tar.gz
upstream-74b20050069bf139ff490f32435f27b927fb4ce7.tar.bz2
upstream-74b20050069bf139ff490f32435f27b927fb4ce7.zip
ps3: update ps3vram patches
SVN-Revision: 15011
Diffstat (limited to 'target/linux/ps3/patches-2.6.28/0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch')
-rw-r--r--target/linux/ps3/patches-2.6.28/0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/target/linux/ps3/patches-2.6.28/0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch b/target/linux/ps3/patches-2.6.28/0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch
new file mode 100644
index 0000000000..624be88c30
--- /dev/null
+++ b/target/linux/ps3/patches-2.6.28/0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch
@@ -0,0 +1,82 @@
+From d4ad304841a9790d4fa35e51d6aa9baeba631559 Mon Sep 17 00:00:00 2001
+From: Masakazu Mokuno <mokuno@sm.sony.co.jp>
+Date: Thu, 30 Oct 2008 08:17:18 +0000
+Subject: [PATCH] powerpc/ps3: Fix memory leak in device init
+
+Free dynamically allocated device data structures when device registration
+fails. This fixes memory leakage when the registration fails.
+
+Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp>
+Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
+Signed-off-by: Paul Mackerras <paulus@samba.org>
+---
+ arch/powerpc/platforms/ps3/device-init.c | 29 ++++++++++++++++++++++++-----
+ 1 files changed, 24 insertions(+), 5 deletions(-)
+
+diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
+index ffdd8e9..43816da 100644
+--- a/arch/powerpc/platforms/ps3/device-init.c
++++ b/arch/powerpc/platforms/ps3/device-init.c
+@@ -314,11 +314,17 @@ static int __init ps3_setup_vuart_device(enum ps3_match_id match_id,
+
+ result = ps3_system_bus_device_register(&p->dev);
+
+- if (result)
++ if (result) {
+ pr_debug("%s:%d ps3_system_bus_device_register failed\n",
+ __func__, __LINE__);
+-
++ goto fail_device_register;
++ }
+ pr_debug(" <- %s:%d\n", __func__, __LINE__);
++ return 0;
++
++fail_device_register:
++ kfree(p);
++ pr_debug(" <- %s:%d fail\n", __func__, __LINE__);
+ return result;
+ }
+
+@@ -463,11 +469,17 @@ static int __init ps3_register_sound_devices(void)
+
+ result = ps3_system_bus_device_register(&p->dev);
+
+- if (result)
++ if (result) {
+ pr_debug("%s:%d ps3_system_bus_device_register failed\n",
+ __func__, __LINE__);
+-
++ goto fail_device_register;
++ }
+ pr_debug(" <- %s:%d\n", __func__, __LINE__);
++ return 0;
++
++fail_device_register:
++ kfree(p);
++ pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
+ return result;
+ }
+
+@@ -491,11 +503,18 @@ static int __init ps3_register_graphics_devices(void)
+
+ result = ps3_system_bus_device_register(&p->dev);
+
+- if (result)
++ if (result) {
+ pr_debug("%s:%d ps3_system_bus_device_register failed\n",
+ __func__, __LINE__);
++ goto fail_device_register;
++ }
+
+ pr_debug(" <- %s:%d\n", __func__, __LINE__);
++ return 0;
++
++fail_device_register:
++ kfree(p);
++ pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
+ return result;
+ }
+
+--
+1.6.0.4
+