fix: lookup_fd_rcu replaced by lookup_fdget_rcu in linux 6.7.0-rc1
[lttng-modules.git] / src / probes / lttng-uprobes.c
index a3cef0bf101e26fe27c3416f5d823ff3be023254..edded1e960aee6a508020bb527b1912c62ce1c91 100644 (file)
  */
 
 #include <wrapper/fdtable.h>
+#include <linux/file.h>
 #include <linux/list.h>
 #include <linux/module.h>
 #include <linux/namei.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/uprobes.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <wrapper/irqflags.h>
 #include <ringbuffer/frontend_types.h>
-#include <wrapper/uprobes.h>
 #include <wrapper/vmalloc.h>
 
 static
@@ -152,7 +154,7 @@ static struct inode *get_inode_from_fd(int fd)
         * Returns the file backing the given fd. Needs to be done inside an RCU
         * critical section.
         */
-       file = lttng_lookup_fd_rcu(fd);
+       file = lttng_lookup_fdget_rcu(fd);
        if (file == NULL) {
                printk(KERN_WARNING "LTTng: Cannot access file backing the fd(%d)\n", fd);
                inode = NULL;
@@ -163,8 +165,11 @@ static struct inode *get_inode_from_fd(int fd)
        inode = igrab(file->f_path.dentry->d_inode);
        if (inode == NULL)
                printk(KERN_WARNING "LTTng: Cannot grab a reference on the inode.\n");
+
 error:
        rcu_read_unlock();
+       if (file)
+               fput(file);
        return inode;
 }
 
@@ -201,7 +206,7 @@ int lttng_uprobes_add_callsite(struct lttng_uprobe *uprobe,
                goto register_error;
        }
 
-       ret = wrapper_uprobe_register(uprobe->inode,
+       ret = uprobe_register(uprobe->inode,
                      uprobe_handler->offset, &uprobe_handler->up_consumer);
        if (ret) {
                printk(KERN_WARNING "LTTng: Error registering probe on inode %lu "
@@ -280,7 +285,7 @@ void lttng_uprobes_unregister(struct inode *inode, struct list_head *head)
         * and free the struct.
         */
        list_for_each_entry_safe(iter, tmp, head, node) {
-               wrapper_uprobe_unregister(inode, iter->offset, &iter->up_consumer);
+               uprobe_unregister(inode, iter->offset, &iter->up_consumer);
                list_del(&iter->node);
                kfree(iter);
        }
This page took 0.023953 seconds and 4 git commands to generate.