Skip to content

Commit c6859ee

Browse files
committed
Merge tag 's390-7.2-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Vasily Gorbik: - Fix checksum lib on machines without the vector facility where the non-vector fallback made csum_partial() calculate the checksum from address 0 instead of the provided buffer - Fix cpum_cf perf event initialization missing speculation barrier for user controlled event numbers used as generic event array indexes * tag 's390-7.2-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/perf_cpum_cf: Add missing array_index_nospec() to __hw_perf_event_init() s390/checksum: Fix csum_partial() without vector facility
2 parents 80c1c30 + 49145bc commit c6859ee

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

arch/s390/kernel/perf_cpum_cf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/init.h>
1616
#include <linux/miscdevice.h>
1717
#include <linux/perf_event.h>
18+
#include <linux/nospec.h>
1819

1920
#include <asm/cpu_mf.h>
2021
#include <asm/hwctrset.h>
@@ -768,6 +769,7 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)
768769
if (!is_userspace_event(ev)) {
769770
if (ev >= ARRAY_SIZE(cpumf_generic_events_user))
770771
return -EOPNOTSUPP;
772+
ev = array_index_nospec(ev, ARRAY_SIZE(cpumf_generic_events_user));
771773
ev = cpumf_generic_events_user[ev];
772774
}
773775
} else if (!attr->exclude_kernel && attr->exclude_user) {
@@ -778,6 +780,7 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)
778780
if (!is_userspace_event(ev)) {
779781
if (ev >= ARRAY_SIZE(cpumf_generic_events_basic))
780782
return -EOPNOTSUPP;
783+
ev = array_index_nospec(ev, ARRAY_SIZE(cpumf_generic_events_basic));
781784
ev = cpumf_generic_events_basic[ev];
782785
}
783786
}

arch/s390/lib/csum-partial.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static __always_inline __wsum csum_copy(void *dst, const void *src, int len, __w
2323
if (!cpu_has_vx()) {
2424
if (copy)
2525
memcpy(dst, src, len);
26-
return cksm(dst, len, sum);
26+
return cksm(src, len, sum);
2727
}
2828
kernel_fpu_begin(&vxstate, KERNEL_VXR_V16V23);
2929
fpu_vlvgf(16, (__force u32)sum, 1);

0 commit comments

Comments
 (0)