aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/ptrace.c8
-rw-r--r--kernel/hw_breakpoint.c4
-rw-r--r--kernel/trace/trace_ksym.c16
-rw-r--r--samples/hw_breakpoint/data_breakpoint.c3
4 files changed, 7 insertions, 24 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index b25f8947ed7a..75e0cd847bd6 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -657,10 +657,7 @@ restore:
657 tsk, true); 657 tsk, true);
658 thread->ptrace_bps[i] = NULL; 658 thread->ptrace_bps[i] = NULL;
659 659
660 if (!bp) { /* incorrect bp, or we have a bug in bp API */ 660 /* Incorrect bp, or we have a bug in bp API */
661 rc = -EINVAL;
662 break;
663 }
664 if (IS_ERR(bp)) { 661 if (IS_ERR(bp)) {
665 rc = PTR_ERR(bp); 662 rc = PTR_ERR(bp);
666 bp = NULL; 663 bp = NULL;
@@ -729,9 +726,6 @@ static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr,
729 tsk, 726 tsk,
730 bp->attr.disabled); 727 bp->attr.disabled);
731 } 728 }
732
733 if (!bp)
734 return -EIO;
735 /* 729 /*
736 * CHECKME: the previous code returned -EIO if the addr wasn't a 730 * CHECKME: the previous code returned -EIO if the addr wasn't a
737 * valid task virtual addr. The new one will return -EINVAL in this 731 * valid task virtual addr. The new one will return -EINVAL in this
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index 06d372fc026d..dd3fb4a999d3 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -442,7 +442,7 @@ register_wide_hw_breakpoint(unsigned long addr,
442 442
443 *pevent = bp; 443 *pevent = bp;
444 444
445 if (IS_ERR(bp) || !bp) { 445 if (IS_ERR(bp)) {
446 err = PTR_ERR(bp); 446 err = PTR_ERR(bp);
447 goto fail; 447 goto fail;
448 } 448 }
@@ -453,7 +453,7 @@ register_wide_hw_breakpoint(unsigned long addr,
453fail: 453fail:
454 for_each_possible_cpu(cpu) { 454 for_each_possible_cpu(cpu) {
455 pevent = per_cpu_ptr(cpu_events, cpu); 455 pevent = per_cpu_ptr(cpu_events, cpu);
456 if (IS_ERR(*pevent) || !*pevent) 456 if (IS_ERR(*pevent))
457 break; 457 break;
458 unregister_hw_breakpoint(*pevent); 458 unregister_hw_breakpoint(*pevent);
459 } 459 }
diff --git a/kernel/trace/trace_ksym.c b/kernel/trace/trace_ksym.c
index 9f040e42f516..c538b15b95d6 100644
--- a/kernel/trace/trace_ksym.c
+++ b/kernel/trace/trace_ksym.c
@@ -200,12 +200,9 @@ int process_new_ksym_entry(char *ksymname, int op, unsigned long addr)
200 entry->ksym_hbp = register_wide_hw_breakpoint(entry->ksym_addr, 200 entry->ksym_hbp = register_wide_hw_breakpoint(entry->ksym_addr,
201 entry->len, entry->type, 201 entry->len, entry->type,
202 ksym_hbp_handler, true); 202 ksym_hbp_handler, true);
203
203 if (IS_ERR(entry->ksym_hbp)) { 204 if (IS_ERR(entry->ksym_hbp)) {
204 entry->ksym_hbp = NULL;
205 ret = PTR_ERR(entry->ksym_hbp); 205 ret = PTR_ERR(entry->ksym_hbp);
206 }
207
208 if (!entry->ksym_hbp) {
209 printk(KERN_INFO "ksym_tracer request failed. Try again" 206 printk(KERN_INFO "ksym_tracer request failed. Try again"
210 " later!!\n"); 207 " later!!\n");
211 goto err; 208 goto err;
@@ -332,21 +329,16 @@ static ssize_t ksym_trace_filter_write(struct file *file,
332 if (changed) { 329 if (changed) {
333 unregister_wide_hw_breakpoint(entry->ksym_hbp); 330 unregister_wide_hw_breakpoint(entry->ksym_hbp);
334 entry->type = op; 331 entry->type = op;
332 ret = 0;
335 if (op > 0) { 333 if (op > 0) {
336 entry->ksym_hbp = 334 entry->ksym_hbp =
337 register_wide_hw_breakpoint(entry->ksym_addr, 335 register_wide_hw_breakpoint(entry->ksym_addr,
338 entry->len, entry->type, 336 entry->len, entry->type,
339 ksym_hbp_handler, true); 337 ksym_hbp_handler, true);
340 if (IS_ERR(entry->ksym_hbp)) 338 if (IS_ERR(entry->ksym_hbp))
341 entry->ksym_hbp = NULL; 339 ret = PTR_ERR(entry->ksym_hbp);
342 340 else
343 /* modified without problem */
344 if (entry->ksym_hbp) {
345 ret = 0;
346 goto out; 341 goto out;
347 }
348 } else {
349 ret = 0;
350 } 342 }
351 /* Error or "symbol:---" case: drop it */ 343 /* Error or "symbol:---" case: drop it */
352 ksym_filter_entry_count--; 344 ksym_filter_entry_count--;
diff --git a/samples/hw_breakpoint/data_breakpoint.c b/samples/hw_breakpoint/data_breakpoint.c
index 95063818bcf4..ee7f9fbaffbd 100644
--- a/samples/hw_breakpoint/data_breakpoint.c
+++ b/samples/hw_breakpoint/data_breakpoint.c
@@ -61,9 +61,6 @@ static int __init hw_break_module_init(void)
61 if (IS_ERR(sample_hbp)) { 61 if (IS_ERR(sample_hbp)) {
62 ret = PTR_ERR(sample_hbp); 62 ret = PTR_ERR(sample_hbp);
63 goto fail; 63 goto fail;
64 } else if (!sample_hbp) {
65 ret = -EINVAL;
66 goto fail;
67 } 64 }
68 65
69 printk(KERN_INFO "HW Breakpoint for %s write installed\n", ksym_name); 66 printk(KERN_INFO "HW Breakpoint for %s write installed\n", ksym_name);