vfio/pci: fix memory leaks of eventfd ctx
Qian Cai authored
[ Upstream commit 1518ac27 ]

Finished a qemu-kvm (-device vfio-pci,host=0001:01:00.0) triggers a few
memory leaks after a while because vfio_pci_set_ctx_trigger_single()
calls eventfd_ctx_fdget() without the matching eventfd_ctx_put() later.
Fix it by calling eventfd_ctx_put() for those memory in
vfio_pci_release() before vfio_device_release().

unreferenced object 0xebff008981cc2b00 (size 128):
  comm "qemu-kvm", pid 4043, jiffies 4294994816 (age 9796.310s)
  hex dump (first 32 bytes):
    01 00 00 00 6b 6b 6b 6b 00 00 00 00 ad 4e ad de  ....kkkk.....N..
    ff ff ff ff 6b 6b 6b 6b ff ff ff ff ff ff ff ff  ....kkkk........
  backtrace:
    [<00000000917e8f8d>] slab_post_alloc_hook+0x74/0x9c
    [<00000000df0f2aa2>] kmem_cache_alloc_trace+0x2b4/0x3d4
    [<000000005fcec025>] do_eventfd+0x54/0x1ac
    [<0000000082791a69>] __arm64_sys_eventfd2+0x34/0x44
    [<00000000b819758c>] do_el0_svc+0x128/0x1dc
    [<00000000b244e810>] el0_sync...
c467ff96
Name Last commit Last update
Documentation dt-bindings: sound: wm8994: Correct required supplies based on actual implementaion
arch arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
block block: ensure bdi->io_pages is always initialized
certs Replace magic for trusting the secondary keyring with #define
crypto crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock()
drivers vfio/pci: fix memory leaks of eventfd ctx
firmware Fix built-in early-load Intel microcode alignment
fs btrfs: don't force read-only after error in drop snapshot
include NFS: Fix races nfs_page_group_destroy() vs nfs_destroy_unlinked_subrequests()
init x86: Fix early boot crash on gcc-10, third try
ipc ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
kernel printk: handle blank console arguments passed in.
lib test_kmod: avoid potential double free in trigger_config_run_type()
mm mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area
net Bluetooth: Handle Inquiry Cancel error after Inquiry Complete
samples samples: bpf: Fix build error
scripts checkpatch: fix the usage of capture group ( ... )
security selinux: sel_avc_get_stat_idx should increase position index
sound ALSA: hda: Fix potential race in unsol event handler
tools tools: gpio-hammer: Avoid potential overflow in main
usr initramfs: restore default compression behavior
virt KVM: fix overflow of zero page refcount with ksm running
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Add hch to .get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files
.gitignore kbuild: rpm-pkg: keep spec file until make mrproper
.mailmap .mailmap: Add Maciej W. Rozycki's Imagination e-mail address
COPYING [PATCH] update FSF address in COPYING
CREDITS MAINTAINERS: update TPM driver infrastructure changes
Kbuild License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license
MAINTAINERS MAINTAINERS: Update drm/i915 bug filing URL
Makefile Linux 4.14.199
README README: add a new README file, pointing to the Documentation/
Linux kernel
============

This file was moved to Documentation/admin-guide/README.rst

Please notice that there are several guides for kernel developers and users.
These guides can be rendered in a number of formats, like HTML and PDF.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.