]> sourceware.org Git - systemtap.git/commitdiff
Move __stp_tf_vma_map check from commit 972ea1 to stap_find_vma_map_info().
authorMark Wielaard <mjw@redhat.com>
Fri, 9 Dec 2011 14:24:03 +0000 (15:24 +0100)
committerMark Wielaard <mjw@redhat.com>
Fri, 9 Dec 2011 14:24:03 +0000 (15:24 +0100)
Commit 972ea1 misapplied the check to stap_add_vma_map_info. This can
never be called when the vma tracker hasn't been initialized. But
stap_find_vma_map_info[_user] potentially could be called. And so this
function needs to check that sure__stp_tf_vma_map is initialized.

runtime/task_finder_vma.c

index 8b5b1ce6f01a013f3e740338cbe4230ddf7c1dbc..90a34baf3ac0c859511ac7c6b5ccf08451638163 100644 (file)
@@ -172,9 +172,6 @@ stap_add_vma_map_info(struct task_struct *tsk,
        struct __stp_tf_vma_entry *new_entry;
        unsigned long flags;
 
-       if (__stp_tf_vma_map == NULL)
-               return rc;
-
        // Take a write lock, since we are most likely going to write
        // after reading. But reserve a new entry first outside the lock.
        new_entry = __stp_tf_vma_new_entry();
@@ -281,8 +278,11 @@ stap_find_vma_map_info(struct task_struct *tsk, unsigned long addr,
        struct __stp_tf_vma_entry *entry;
        struct __stp_tf_vma_entry *found_entry = NULL;
        int rc = -ESRCH;
-
        unsigned long flags;
+
+       if (__stp_tf_vma_map == NULL)
+               return rc;
+
        read_lock_irqsave(&__stp_tf_vma_lock, flags);
        head = &__stp_tf_vma_map[__stp_tf_vma_map_hash(tsk)];
        hlist_for_each_entry(entry, node, head, hlist) {
@@ -322,8 +322,11 @@ stap_find_vma_map_info_user(struct task_struct *tsk, void *user,
        struct __stp_tf_vma_entry *entry;
        struct __stp_tf_vma_entry *found_entry = NULL;
        int rc = -ESRCH;
-
        unsigned long flags;
+
+       if (__stp_tf_vma_map == NULL)
+               return rc;
+
        read_lock_irqsave(&__stp_tf_vma_lock, flags);
        head = &__stp_tf_vma_map[__stp_tf_vma_map_hash(tsk)];
        hlist_for_each_entry(entry, node, head, hlist) {
This page took 0.030417 seconds and 5 git commands to generate.