Fix: fd-tracker: dereference of lttng_inode after NULL check
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 25 Nov 2019 21:40:10 +0000 (16:40 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 25 Nov 2019 22:06:13 +0000 (17:06 -0500)
handle->inode is checked for NULL but used unconditionaly
on line 873 (lttng_inode_put).

1407756 Dereference after null check
Either the check against null is unnecessary, or there may be a null pointer dereference.
In fs_handle_close: Pointer is checked against null but then dereferenced anyway (CWE-476)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/fd-tracker/fd-tracker.c

index acbee670a0acdf4086853a98460b7f923f0e444d..555ff4a780a8166c47b7a21efb8ab6cf5d416a57 100644 (file)
@@ -870,7 +870,9 @@ int fs_handle_close(struct fs_handle *handle)
                }
                handle->fd = -1;
        }
-       lttng_inode_put(handle->inode);
+       if (handle->inode) {
+               lttng_inode_put(handle->inode);
+       }
        pthread_mutex_unlock(&handle->lock);
        pthread_mutex_destroy(&handle->lock);
        pthread_mutex_unlock(&handle->tracker->lock);
This page took 0.026588 seconds and 4 git commands to generate.