]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio/pci: Clear token on bypass registration failure
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 19 Oct 2020 13:13:55 +0000 (07:13 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 09:08:08 +0000 (10:08 +0100)
commit4f9ece8b888ff8612c5d47119b7216a383b9d8cc
tree97b01e07edbea026e75563fa4c334e0eb349e5fe
parent6d0590647b756cc5b7e28f3c8577f0f9f253f0a2
vfio/pci: Clear token on bypass registration failure

[ Upstream commit 852b1beecb6ff9326f7ca4bc0fe69ae860ebdb9e ]

The eventfd context is used as our irqbypass token, therefore if an
eventfd is re-used, our token is the same.  The irqbypass code will
return an -EBUSY in this case, but we'll still attempt to unregister
the producer, where if that duplicate token still exists, results in
removing the wrong object.  Clear the token of failed producers so
that they harmlessly fall out when unregistered.

Fixes: 6d7425f109d2 ("vfio: Register/unregister irq_bypass_producer")
Reported-by: guomin chen <guomin_chen@sina.com>
Tested-by: guomin chen <guomin_chen@sina.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/pci/vfio_pci_intrs.c