From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail137.messagelabs.com (mail137.messagelabs.com [216.82.249.19]) by kanga.kvack.org (Postfix) with ESMTP id E20126B00E3 for ; Wed, 23 Nov 2011 11:09:25 -0500 (EST) Message-ID: <1322064540.14799.78.camel@twins> Subject: Re: [PATCH v7 3.2-rc2 3/30] uprobes: register/unregister probes. From: Peter Zijlstra Date: Wed, 23 Nov 2011 17:09:00 +0100 In-Reply-To: <20111118110713.10512.9461.sendpatchset@srdronam.in.ibm.com> References: <20111118110631.10512.73274.sendpatchset@srdronam.in.ibm.com> <20111118110713.10512.9461.sendpatchset@srdronam.in.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Sender: owner-linux-mm@kvack.org List-ID: To: Srikar Dronamraju Cc: Linus Torvalds , Oleg Nesterov , Andrew Morton , LKML , Linux-mm , Ingo Molnar , Andi Kleen , Christoph Hellwig , Steven Rostedt , Roland McGrath , Thomas Gleixner , Masami Hiramatsu , Arnaldo Carvalho de Melo , Anton Arapov , Ananth N Mavinakayanahalli , Jim Keniston , Stephen Wilson On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote: > +static int __register_uprobe(struct inode *inode, loff_t offset, > + struct uprobe *uprobe) > +{ > + struct list_head try_list; > + struct vm_area_struct *vma; > + struct address_space *mapping; > + struct vma_info *vi, *tmpvi; > + struct mm_struct *mm; > + loff_t vaddr; > + int ret =3D 0; > + > + mapping =3D inode->i_mapping; > + INIT_LIST_HEAD(&try_list); > + while ((vi =3D find_next_vma_info(&try_list, offset, > + mapping, true)) !=3D NULL= ) { > + if (IS_ERR(vi)) { > + ret =3D -ENOMEM; > + break; > + } > + mm =3D vi->mm; > + down_read(&mm->mmap_sem); > + vma =3D find_vma(mm, (unsigned long)vi->vaddr); > + if (!vma || !valid_vma(vma, true)) { > + list_del(&vi->probe_list); > + kfree(vi); > + up_read(&mm->mmap_sem); > + mmput(mm); > + continue; > + } > + vaddr =3D vma->vm_start + offset; > + vaddr -=3D vma->vm_pgoff << PAGE_SHIFT; > + if (vma->vm_file->f_mapping->host !=3D inode || > + vaddr !=3D vi->vaddr) { > + list_del(&vi->probe_list); > + kfree(vi); > + up_read(&mm->mmap_sem); > + mmput(mm); > + continue; > + } > + ret =3D install_breakpoint(mm); > + up_read(&mm->mmap_sem); > + mmput(mm); > + if (ret && ret =3D=3D -EEXIST) > + ret =3D 0; > + if (!ret) > + break; Shouldn't that read: if (ret) break; So that we bail when there's a real error instead of no error? > + } > + list_for_each_entry_safe(vi, tmpvi, &try_list, probe_list) { > + list_del(&vi->probe_list); > + kfree(vi); > + } > + return ret; > +}=20 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org