From 4c372c5422386026177f9e07ec80566a3d9b8ac5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 25 Nov 2019 16:40:10 -0500 Subject: [PATCH] Fix: fd-tracker: dereference of lttng_inode after NULL check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/fd-tracker/fd-tracker.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/fd-tracker/fd-tracker.c b/src/common/fd-tracker/fd-tracker.c index acbee670a..555ff4a78 100644 --- a/src/common/fd-tracker/fd-tracker.c +++ b/src/common/fd-tracker/fd-tracker.c @@ -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); -- 2.34.1