User: | Jiri Slaby |
Error type: | Resource Leak |
Error type description: | The code omits to put the resource to the system for reuse |
File location: | arch/x86/kernel/kprobes.c |
Line in file: | 542 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2011-11-07 22:40:13 UTC |
512 * Interrupts are disabled on entry as trap3 is an interrupt gate and they 513 * remain disabled thorough out this function. 514 */ 515static int __kprobes kprobe_handler(struct pt_regs *regs) 516{ 517 kprobe_opcode_t *addr; 518 struct kprobe *p; 519 struct kprobe_ctlblk *kcb; 520 521 addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t)); 522 if (*addr != BREAKPOINT_INSTRUCTION) { 523 /* 524 * The breakpoint instruction was removed right 525 * after we hit it. Another cpu has removed 526 * either a probepoint or a debugger breakpoint 527 * at this address. In either case, no further 528 * handling of this interrupt is appropriate. 529 * Back up over the (now missing) int3 and run 530 * the original instruction. 531 */ 532 regs->ip = (unsigned long)addr; 533 return 1; 534 } 535 536 /* 537 * We don't want to be preempted for the entire 538 * duration of kprobe processing. We conditionally 539 * re-enable preemption at the end of this function, 540 * and also in reenter_kprobe() and setup_singlestep(). 541 */ 542 preempt_disable(); 543 544 kcb = get_kprobe_ctlblk(); 545 p = get_kprobe(addr); 546 547 if (p) { 548 if (kprobe_running()) { 549 if (reenter_kprobe(p, regs, kcb)) 550 return 1; 551 } else { 552 set_current_kprobe(p, regs, kcb);