diff for duplicates of <20100831103001.GC22783@erda.amd.com> diff --git a/a/1.txt b/N1/1.txt index a8ea72d..318e79c 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -11,3 +11,68 @@ This is the patch, applied to: -Robert -- + +>From 10f0412f57f2a76a90eff4376f59cbb0a39e4e18 Mon Sep 17 00:00:00 2001 +From: Robert Richter <robert.richter@amd.com> +Date: Mon, 30 Aug 2010 10:56:18 +0200 +Subject: [PATCH] oprofile, x86: fix init_sysfs error handling + +On failure init_sysfs() might not properly free resources. The error +code of the function is not checked. And, when reinitializing the exit +function might be called twice. This patch fixes all this. + +Cc: stable@kernel.org +Signed-off-by: Robert Richter <robert.richter@amd.com> +--- + arch/x86/oprofile/nmi_int.c | 16 +++++++++++++--- + 1 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c +index f6b48f6..73a41d3 100644 +--- a/arch/x86/oprofile/nmi_int.c ++++ b/arch/x86/oprofile/nmi_int.c +@@ -568,8 +568,13 @@ static int __init init_sysfs(void) + int error; + + error = sysdev_class_register(&oprofile_sysclass); +- if (!error) +- error = sysdev_register(&device_oprofile); ++ if (error) ++ return error; ++ ++ error = sysdev_register(&device_oprofile); ++ if (error) ++ sysdev_class_unregister(&oprofile_sysclass); ++ + return error; + } + +@@ -695,6 +700,8 @@ int __init op_nmi_init(struct oprofile_operations *ops) + char *cpu_type = NULL; + int ret = 0; + ++ using_nmi = 0; ++ + if (!cpu_has_apic) + return -ENODEV; + +@@ -774,7 +781,10 @@ int __init op_nmi_init(struct oprofile_operations *ops) + + mux_init(ops); + +- init_sysfs(); ++ ret = init_sysfs(); ++ if (ret) ++ return ret; ++ + using_nmi = 1; + printk(KERN_INFO "oprofile: using NMI interrupt.\n"); + return 0; +-- +1.7.1.1 + + + +-- +Advanced Micro Devices, Inc. +Operating System Research Center diff --git a/a/content_digest b/N1/content_digest index da5d6fc..0c697fb 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -6,10 +6,15 @@ "ref\01283244880.645.17.camel@e102144-lin.cambridge.arm.com\0" "ref\020100831090518.GZ22783@erda.amd.com\0" "ref\01283247089.4063.2.camel@e102144-lin.cambridge.arm.com\0" - "From\0robert.richter@amd.com (Robert Richter)\0" + "From\0Robert Richter <robert.richter@amd.com>\0" "Subject\0[PATCH] oprofile, x86: fix init_sysfs error handling\0" "Date\0Tue, 31 Aug 2010 12:30:01 +0200\0" - "To\0linux-arm-kernel@lists.infradead.org\0" + "To\0Will Deacon <will.deacon@arm.com>\0" + "Cc\0linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>" + linux-arm-kernel@lists.infradead.org <linux-arm-kernel@lists.infradead.org> + Matt Fleming <matt@console-pimps.org> + Peter Zijlstra <peterz@infradead.org> + " Ingo Molnar <mingo@elte.hu>\0" "\00:1\0" "b\0" "On 31.08.10 05:31:29, Will Deacon wrote:\n" @@ -24,6 +29,71 @@ "\n" "-Robert\n" "\n" - -- + "--\n" + "\n" + ">From 10f0412f57f2a76a90eff4376f59cbb0a39e4e18 Mon Sep 17 00:00:00 2001\n" + "From: Robert Richter <robert.richter@amd.com>\n" + "Date: Mon, 30 Aug 2010 10:56:18 +0200\n" + "Subject: [PATCH] oprofile, x86: fix init_sysfs error handling\n" + "\n" + "On failure init_sysfs() might not properly free resources. The error\n" + "code of the function is not checked. And, when reinitializing the exit\n" + "function might be called twice. This patch fixes all this.\n" + "\n" + "Cc: stable@kernel.org\n" + "Signed-off-by: Robert Richter <robert.richter@amd.com>\n" + "---\n" + " arch/x86/oprofile/nmi_int.c | 16 +++++++++++++---\n" + " 1 files changed, 13 insertions(+), 3 deletions(-)\n" + "\n" + "diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c\n" + "index f6b48f6..73a41d3 100644\n" + "--- a/arch/x86/oprofile/nmi_int.c\n" + "+++ b/arch/x86/oprofile/nmi_int.c\n" + "@@ -568,8 +568,13 @@ static int __init init_sysfs(void)\n" + " \tint error;\n" + " \n" + " \terror = sysdev_class_register(&oprofile_sysclass);\n" + "-\tif (!error)\n" + "-\t\terror = sysdev_register(&device_oprofile);\n" + "+\tif (error)\n" + "+\t\treturn error;\n" + "+\n" + "+\terror = sysdev_register(&device_oprofile);\n" + "+\tif (error)\n" + "+\t\tsysdev_class_unregister(&oprofile_sysclass);\n" + "+\n" + " \treturn error;\n" + " }\n" + " \n" + "@@ -695,6 +700,8 @@ int __init op_nmi_init(struct oprofile_operations *ops)\n" + " \tchar *cpu_type = NULL;\n" + " \tint ret = 0;\n" + " \n" + "+\tusing_nmi = 0;\n" + "+\n" + " \tif (!cpu_has_apic)\n" + " \t\treturn -ENODEV;\n" + " \n" + "@@ -774,7 +781,10 @@ int __init op_nmi_init(struct oprofile_operations *ops)\n" + " \n" + " \tmux_init(ops);\n" + " \n" + "-\tinit_sysfs();\n" + "+\tret = init_sysfs();\n" + "+\tif (ret)\n" + "+\t\treturn ret;\n" + "+\n" + " \tusing_nmi = 1;\n" + " \tprintk(KERN_INFO \"oprofile: using NMI interrupt.\\n\");\n" + " \treturn 0;\n" + "-- \n" + "1.7.1.1\n" + "\n" + "\n" + "\n" + "-- \n" + "Advanced Micro Devices, Inc.\n" + Operating System Research Center -7ad048074ce3d27303e47705a04ca28afb535f8422e1c71b6e7ccfcc7f4429e5 +baa608edf911995f23859c9ed0eb90c124acf3aa173b5f40ed220b134272679c
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.