vhost: fix file struct leakage
authorPavel Boldin <pboldin@mirantis.com>
Mon, 23 Mar 2015 12:53:45 +0000 (14:53 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 26 Mar 2015 21:33:41 +0000 (22:33 +0100)
Due to increased `struct file's reference counter subsequent call
to `filp_close' does not free the `struct file'. Prepend `fput' call
to decrease the reference counter.

Signed-off-by: Pavel Boldin <pboldin@mirantis.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
lib/librte_vhost/eventfd_link/eventfd_link.c

index 7755dd6..62c45c8 100644 (file)
@@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl, unsigned long arg)
                 * Release the existing eventfd in the source process
                 */
                spin_lock(&files->file_lock);
+               fput(file);
                filp_close(file, files);
                fdt = files_fdtable(files);
                fdt->fd[eventfd_copy.source_fd] = NULL;