]> git.baikalelectronics.ru Git - kernel.git/commit
uio/uio_pci_generic: Disable bus-mastering on release
authorVenkatesh Srinivas <venkateshs@google.com>
Wed, 23 Jan 2019 11:27:51 +0000 (11:27 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jan 2019 15:22:51 +0000 (16:22 +0100)
commit9b7a95c0bf092b9aae5c07e6b53c8719cbf8ebcd
tree297392fb063a48e7b8faa6db2759453703dc6030
parent80168368a8ace8c35e03ff69a2232764efa4fae4
uio/uio_pci_generic: Disable bus-mastering on release

Userspace code using uio_pci_generic may enable bus-mastering by
directly manipulating a PCI device's command register. If a userspace
program enables bus-mastering but exits/crashes uncleanly, bus-
mastering will still be enabled and stale DMA addresses may be
programmed and live in the device.

Disable bus-mastering unconditionally on last close of a UIO PCI fd
to avoid this. If the device did not have bus-mastering enabled,
pci_clear_master() is a no-op.

Signed-off-by: Venkatesh Srinivas <venkateshs@google.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Catherine Sullivan <csully@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_pci_generic.c