[FIX] safe US handlers
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 30 Oct 2013 12:48:32 +0000 (16:48 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 30 Oct 2013 12:48:32 +0000 (16:48 +0400)
Check ri->rp on NULL.  It is reset to zero, when unregister uretprobe

Change-Id: I5fda01b4a2d71eccf7cdadba699cb2ec0493f19d
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
us_manager/sspt/ip.c

index 3086ce2..928fc06 100644 (file)
 
 static int entry_handler(struct uretprobe_instance *ri, struct pt_regs *regs)
 {
-       struct us_ip *ip = container_of(ri->rp, struct us_ip, retprobe);
+       struct uretprobe *rp = ri->rp;
+
+       if (rp && get_quiet() == QT_OFF) {
+               struct us_ip *ip = container_of(rp, struct us_ip, retprobe);
 
-       if (get_quiet() == QT_OFF)
                entry_event(ip->args, regs, PT_US, PST_NONE);
+       }
 
        return 0;
 }
 
 static int ret_handler(struct uretprobe_instance *ri, struct pt_regs *regs)
 {
-       struct us_ip *ip = container_of(ri->rp, struct us_ip, retprobe);
-       unsigned long addr = (unsigned long)ip->retprobe.up.kp.addr;
-       unsigned long ret_addr = ri->ret_addr;
+       struct uretprobe *rp = ri->rp;
+
+       if (rp && get_quiet() == QT_OFF) {
+               struct us_ip *ip = container_of(rp, struct us_ip, retprobe);
+               unsigned long addr = (unsigned long)ip->retprobe.up.kp.addr;
+               unsigned long ret_addr = ri->ret_addr;
 
 #if defined(CONFIG_ARM)
-       addr = ip->offset & 0x01 ? addr | 0x01 : addr;
+               addr = ip->offset & 0x01 ? addr | 0x01 : addr;
 #endif
 
-       if (get_quiet() == QT_OFF)
                exit_event(regs, addr, ret_addr);
+       }
 
        return 0;
 }