History

Merge tag 'powerpc-5.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman: - Fix a possible stack corruption and subsequent DLPAR failure in the rpadlpar_io PCI hotplug driver - Two build fixes for uncommon configurations Thanks to Christophe Leroy and Tyrel Datwyler. * tag 'powerpc-5.12-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: PCI: rpadlpar: Fix potential drc_name corruption in store functions powerpc: Force inlining of cpu_has_feature() to avoid build failure powerpc/vdso32: Add missing _restgpr_31_x to fix build failure

Linus Torvalds committed 5 years ago

Commit b35660a2 parents 812da4d cc7a0bb3 files · +19 −10Browse files

Unified · Split

3 files
  1. arch/powerpc/include/asm/cpu_has_feature.h +2 −2
  2. arch/powerpc/kernel/vdso32/gettimeofday.S +11 −0
  3. drivers/pci/hotplug/rpadlpar_sysfs.c +6 −8
arch/powerpc/include/asm/cpu_has_feature.h+2−2
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 #include <linux/bug.h>
88 #include <asm/cputable.h>
99
10−static inline bool early_cpu_has_feature(unsigned long feature)
10+static __always_inline bool early_cpu_has_feature(unsigned long feature)
1111 {
1212 return !!((CPU_FTRS_ALWAYS & feature) ||
1313 (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
@@ -46,7 +46,7 @@ static __always_inline bool cpu_has_feature(unsigned long feature) · 32 unmodified lines
4646 return static_branch_likely(&cpu_feature_keys[i]);
4747 }
4848 #else
49−static inline bool cpu_has_feature(unsigned long feature)
49+static __always_inline bool cpu_has_feature(unsigned long feature)
5050 {
5151 return early_cpu_has_feature(feature);
5252 }
arch/powerpc/kernel/vdso32/gettimeofday.S+11−0
@@ -65,3 +65,14 @@ V_FUNCTION_END(__kernel_clock_getres) · 64 unmodified lines
6565 V_FUNCTION_BEGIN(__kernel_time)
6666 cvdso_call_time __c_kernel_time
6767 V_FUNCTION_END(__kernel_time)
68+
69+/* Routines for restoring integer registers, called by the compiler. */
70+/* Called with r11 pointing to the stack header word of the caller of the */
71+/* function, just beyond the end of the integer restore area. */
72+_GLOBAL(_restgpr_31_x)
73+_GLOBAL(_rest32gpr_31_x)
74+ lwz r0,4(r11)
75+ lwz r31,-4(r11)
76+ mtlr r0
77+ mr r1,r11
78+ blr
drivers/pci/hotplug/rpadlpar_sysfs.c+6−8
@@ -34,12 +34,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr, · 33 unmodified lines
3434 if (nbytes >= MAX_DRC_NAME_LEN)
3535 return 0;
3636
37− memcpy(drc_name, buf, nbytes);
37+ strscpy(drc_name, buf, nbytes + 1);
3838
3939 end = strchr(drc_name, '\n');
40− if (!end)
41− end = &drc_name[nbytes];
42− *end = '\0';
40+ if (end)
41+ *end = '\0';
4342
4443 rc = dlpar_add_slot(drc_name);
4544 if (rc)
@@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj, · 19 unmodified lines
6564 if (nbytes >= MAX_DRC_NAME_LEN)
6665 return 0;
6766
68− memcpy(drc_name, buf, nbytes);
67+ strscpy(drc_name, buf, nbytes + 1);
6968
7069 end = strchr(drc_name, '\n');
71− if (!end)
72− end = &drc_name[nbytes];
73− *end = '\0';
70+ if (end)
71+ *end = '\0';
7472
7573 rc = dlpar_remove_slot(drc_name);
7674 if (rc)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t