mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 02:47:31 -04:00
Merge tag 'iommu-fixes-v5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu fixes from Joerg Roedel:
"Two fixes for the AMD IOMMU driver:
- Fix a potential NULL-ptr dereference found by smatch
- Fix interrupt remapping when a device is assigned to a guest and
AVIC is enabled"
* tag 'iommu-fixes-v5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
iommu/amd: Restore IRTE.RemapEn bit for amd_iommu_activate_guest_mode
iommu/amd: Fix potential @entry null deref
This commit is contained in:
@@ -3840,14 +3840,18 @@ int amd_iommu_activate_guest_mode(void *data)
|
||||
{
|
||||
struct amd_ir_data *ir_data = (struct amd_ir_data *)data;
|
||||
struct irte_ga *entry = (struct irte_ga *) ir_data->entry;
|
||||
u64 valid;
|
||||
|
||||
if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
|
||||
!entry || entry->lo.fields_vapic.guest_mode)
|
||||
return 0;
|
||||
|
||||
valid = entry->lo.fields_vapic.valid;
|
||||
|
||||
entry->lo.val = 0;
|
||||
entry->hi.val = 0;
|
||||
|
||||
entry->lo.fields_vapic.valid = valid;
|
||||
entry->lo.fields_vapic.guest_mode = 1;
|
||||
entry->lo.fields_vapic.ga_log_intr = 1;
|
||||
entry->hi.fields.ga_root_ptr = ir_data->ga_root_ptr;
|
||||
@@ -3864,12 +3868,14 @@ int amd_iommu_deactivate_guest_mode(void *data)
|
||||
struct amd_ir_data *ir_data = (struct amd_ir_data *)data;
|
||||
struct irte_ga *entry = (struct irte_ga *) ir_data->entry;
|
||||
struct irq_cfg *cfg = ir_data->cfg;
|
||||
u64 valid = entry->lo.fields_remap.valid;
|
||||
u64 valid;
|
||||
|
||||
if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) ||
|
||||
!entry || !entry->lo.fields_vapic.guest_mode)
|
||||
return 0;
|
||||
|
||||
valid = entry->lo.fields_remap.valid;
|
||||
|
||||
entry->lo.val = 0;
|
||||
entry->hi.val = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user