Skip to content

Commit

Permalink
Merge tag 'powerpc-5.12-4' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/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
  • Loading branch information
Linus Torvalds committed Mar 21, 2021
2 parents 812da4d + cc7a0bb commit b35660a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/include/asm/cpu_has_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <linux/bug.h>
#include <asm/cputable.h>

static inline bool early_cpu_has_feature(unsigned long feature)
static __always_inline bool early_cpu_has_feature(unsigned long feature)
{
return !!((CPU_FTRS_ALWAYS & feature) ||
(CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
Expand Down Expand Up @@ -46,7 +46,7 @@ static __always_inline bool cpu_has_feature(unsigned long feature)
return static_branch_likely(&cpu_feature_keys[i]);
}
#else
static inline bool cpu_has_feature(unsigned long feature)
static __always_inline bool cpu_has_feature(unsigned long feature)
{
return early_cpu_has_feature(feature);
}
Expand Down
11 changes: 11 additions & 0 deletions arch/powerpc/kernel/vdso32/gettimeofday.S
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,14 @@ V_FUNCTION_END(__kernel_clock_getres)
V_FUNCTION_BEGIN(__kernel_time)
cvdso_call_time __c_kernel_time
V_FUNCTION_END(__kernel_time)

/* Routines for restoring integer registers, called by the compiler. */
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the integer restore area. */
_GLOBAL(_restgpr_31_x)
_GLOBAL(_rest32gpr_31_x)
lwz r0,4(r11)
lwz r31,-4(r11)
mtlr r0
mr r1,r11
blr
14 changes: 6 additions & 8 deletions drivers/pci/hotplug/rpadlpar_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr,
if (nbytes >= MAX_DRC_NAME_LEN)
return 0;

memcpy(drc_name, buf, nbytes);
strscpy(drc_name, buf, nbytes + 1);

end = strchr(drc_name, '\n');
if (!end)
end = &drc_name[nbytes];
*end = '\0';
if (end)
*end = '\0';

rc = dlpar_add_slot(drc_name);
if (rc)
Expand All @@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj,
if (nbytes >= MAX_DRC_NAME_LEN)
return 0;

memcpy(drc_name, buf, nbytes);
strscpy(drc_name, buf, nbytes + 1);

end = strchr(drc_name, '\n');
if (!end)
end = &drc_name[nbytes];
*end = '\0';
if (end)
*end = '\0';

rc = dlpar_remove_slot(drc_name);
if (rc)
Expand Down

0 comments on commit b35660a

Please sign in to comment.