Thread (160 messages) 160 messages, 9 authors, 2011-10-25

Re: [PATCH v5 3.1.0-rc4-tip 3/26] Uprobes: register/unregister probes.

From: Srikar Dronamraju <hidden>
Date: 2011-09-21 04:21:18
Also in: lkml

* Stefan Hajnoczi [off-list ref] [2011-09-20 17:50:19]:
On Tue, Sep 20, 2011 at 05:30:22PM +0530, Srikar Dronamraju wrote:
quoted
+int register_uprobe(struct inode *inode, loff_t offset,
+				struct uprobe_consumer *consumer)
+{
+	struct uprobe *uprobe;
+	int ret = 0;
+
+	inode = igrab(inode);
+	if (!inode || !consumer || consumer->next)
+		return -EINVAL;
+
+	if (offset > inode->i_size)
+		return -EINVAL;
+
+	mutex_lock(&inode->i_mutex);
+	uprobe = alloc_uprobe(inode, offset);
+	if (!uprobe)
+		return -ENOMEM;
The error returns above don't iput(inode).  And inode->i_mutex stays
locked on this return.
Yes will fix this .. by clubbing the !uprobe with the next condition.
Thanks for pointing this.
quoted
+void unregister_uprobe(struct inode *inode, loff_t offset,
+				struct uprobe_consumer *consumer)
+{
+	struct uprobe *uprobe;
+
+	inode = igrab(inode);
+	if (!inode || !consumer)
+		return;
+
+	if (offset > inode->i_size)
+		return;
+
+	uprobe = find_uprobe(inode, offset);
+	if (!uprobe)
+		return;
+
+	if (!del_consumer(uprobe, consumer)) {
+		put_uprobe(uprobe);
+		return;
+	}
More returns that do not iput(inode).
Yes. will fix these too.

-- 
Thanks and Regards
Srikar

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help