Commit d1505b5c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'powerpc-6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Prevent use-after-free in 64-bit KVM VFIO

 - Add generated Power8 crypto asm to .gitignore

Thanks to Al Viro and Nathan Lynch.

* tag 'powerpc-6.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  KVM: PPC: Book3S HV: Prevent UAF in kvm_spapr_tce_attach_iommu_group()
  powerpc/crypto: Add generated P8 asm to .gitignore
parents 5f583a31 a986fa57
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
aesp10-ppc.S aesp10-ppc.S
aesp8-ppc.S
ghashp10-ppc.S ghashp10-ppc.S
ghashp8-ppc.S
...@@ -130,14 +130,16 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, ...@@ -130,14 +130,16 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
} }
rcu_read_unlock(); rcu_read_unlock();
if (!found) {
fdput(f); fdput(f);
if (!found)
return -EINVAL; return -EINVAL;
}
table_group = iommu_group_get_iommudata(grp); table_group = iommu_group_get_iommudata(grp);
if (WARN_ON(!table_group)) if (WARN_ON(!table_group)) {
fdput(f);
return -EFAULT; return -EFAULT;
}
for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) { for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) {
struct iommu_table *tbltmp = table_group->tables[i]; struct iommu_table *tbltmp = table_group->tables[i];
...@@ -158,8 +160,10 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, ...@@ -158,8 +160,10 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
break; break;
} }
} }
if (!tbl) if (!tbl) {
fdput(f);
return -EINVAL; return -EINVAL;
}
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(stit, &stt->iommu_tables, next) { list_for_each_entry_rcu(stit, &stt->iommu_tables, next) {
...@@ -170,6 +174,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, ...@@ -170,6 +174,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
/* stit is being destroyed */ /* stit is being destroyed */
iommu_tce_table_put(tbl); iommu_tce_table_put(tbl);
rcu_read_unlock(); rcu_read_unlock();
fdput(f);
return -ENOTTY; return -ENOTTY;
} }
/* /*
...@@ -177,6 +182,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, ...@@ -177,6 +182,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
* its KVM reference counter and can return. * its KVM reference counter and can return.
*/ */
rcu_read_unlock(); rcu_read_unlock();
fdput(f);
return 0; return 0;
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -184,6 +190,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, ...@@ -184,6 +190,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
stit = kzalloc(sizeof(*stit), GFP_KERNEL); stit = kzalloc(sizeof(*stit), GFP_KERNEL);
if (!stit) { if (!stit) {
iommu_tce_table_put(tbl); iommu_tce_table_put(tbl);
fdput(f);
return -ENOMEM; return -ENOMEM;
} }
...@@ -192,6 +199,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd, ...@@ -192,6 +199,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
list_add_rcu(&stit->next, &stt->iommu_tables); list_add_rcu(&stit->next, &stt->iommu_tables);
fdput(f);
return 0; return 0;
} }
......
Markdown is supported
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