Skip to content

Commit d1505b5

Browse files
committed
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
2 parents 5f583a3 + a986fa5 commit d1505b5

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

arch/powerpc/crypto/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
aesp10-ppc.S
3+
aesp8-ppc.S
34
ghashp10-ppc.S
5+
ghashp8-ppc.S

arch/powerpc/kvm/book3s_64_vio.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,16 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
130130
}
131131
rcu_read_unlock();
132132

133-
fdput(f);
134-
135-
if (!found)
133+
if (!found) {
134+
fdput(f);
136135
return -EINVAL;
136+
}
137137

138138
table_group = iommu_group_get_iommudata(grp);
139-
if (WARN_ON(!table_group))
139+
if (WARN_ON(!table_group)) {
140+
fdput(f);
140141
return -EFAULT;
142+
}
141143

142144
for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) {
143145
struct iommu_table *tbltmp = table_group->tables[i];
@@ -158,8 +160,10 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
158160
break;
159161
}
160162
}
161-
if (!tbl)
163+
if (!tbl) {
164+
fdput(f);
162165
return -EINVAL;
166+
}
163167

164168
rcu_read_lock();
165169
list_for_each_entry_rcu(stit, &stt->iommu_tables, next) {
@@ -170,20 +174,23 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
170174
/* stit is being destroyed */
171175
iommu_tce_table_put(tbl);
172176
rcu_read_unlock();
177+
fdput(f);
173178
return -ENOTTY;
174179
}
175180
/*
176181
* The table is already known to this KVM, we just increased
177182
* its KVM reference counter and can return.
178183
*/
179184
rcu_read_unlock();
185+
fdput(f);
180186
return 0;
181187
}
182188
rcu_read_unlock();
183189

184190
stit = kzalloc(sizeof(*stit), GFP_KERNEL);
185191
if (!stit) {
186192
iommu_tce_table_put(tbl);
193+
fdput(f);
187194
return -ENOMEM;
188195
}
189196

@@ -192,6 +199,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
192199

193200
list_add_rcu(&stit->next, &stt->iommu_tables);
194201

202+
fdput(f);
195203
return 0;
196204
}
197205

0 commit comments

Comments
 (0)