Skip to content
Commit fb3e3065 authored by Mark Salter's avatar Mark Salter Committed by Joerg Roedel
Browse files

iommu: Fix bus notifier breakage



iommu_bus_init() registers a bus notifier on the given bus by using
a statically defined notifier block:

  static struct notifier_block iommu_bus_nb = {
          .notifier_call = iommu_bus_notifier,
  };

This same notifier block is used for all busses. This causes a
problem for notifiers registered after iommu has registered this
callback on multiple busses. The problem is that a subsequent
notifier being registered on a bus which has this iommu notifier
will also get linked in to the notifier list of all other busses
which have this iommu notifier.

This patch fixes this by allocating the notifier_block at runtime.
Some error checking is also added to catch any allocation failure
or notifier registration error.

Signed-off-by: default avatarMark Salter <msalter@redhat.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 25b11ce2
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment