Skip to content

Commit 3d54ac9

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "EFI fixes, and FPU fix, a ticket spinlock boundary condition fix and two build fixes" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fpu: Always restore_xinit_state() when use_eager_cpu() x86: Make cpu_tss available to external modules efi: Fix error handling in add_sysfs_runtime_map_entry() x86/spinlocks: Fix regression in spinlock contention detection x86/mm: Clean up types in xlate_dev_mem_ptr() x86/efi: Store upper bits of command line buffer address in ext_cmd_line_ptr efivarfs: Ensure VariableName is NUL-terminated
2 parents d8fce2d + c88d474 commit 3d54ac9

File tree

6 files changed

+23
-17
lines changed

6 files changed

+23
-17
lines changed

arch/x86/boot/compressed/eboot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,8 @@ struct boot_params *make_boot_params(struct efi_config *c)
11091109
if (!cmdline_ptr)
11101110
goto fail;
11111111
hdr->cmd_line_ptr = (unsigned long)cmdline_ptr;
1112+
/* Fill in upper bits of command line address, NOP on 32 bit */
1113+
boot_params->ext_cmd_line_ptr = (u64)(unsigned long)cmdline_ptr >> 32;
11121114

11131115
hdr->ramdisk_image = 0;
11141116
hdr->ramdisk_size = 0;

arch/x86/include/asm/spinlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static inline int arch_spin_is_contended(arch_spinlock_t *lock)
169169
struct __raw_tickets tmp = READ_ONCE(lock->tickets);
170170

171171
tmp.head &= ~TICKET_SLOWPATH_FLAG;
172-
return (tmp.tail - tmp.head) > TICKET_LOCK_INC;
172+
return (__ticket_t)(tmp.tail - tmp.head) > TICKET_LOCK_INC;
173173
}
174174
#define arch_spin_is_contended arch_spin_is_contended
175175

arch/x86/kernel/process.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss) = {
5757
.io_bitmap = { [0 ... IO_BITMAP_LONGS] = ~0 },
5858
#endif
5959
};
60-
EXPORT_PER_CPU_SYMBOL_GPL(cpu_tss);
60+
EXPORT_PER_CPU_SYMBOL(cpu_tss);
6161

6262
#ifdef CONFIG_X86_64
6363
static DEFINE_PER_CPU(unsigned char, is_idle);
@@ -156,11 +156,13 @@ void flush_thread(void)
156156
/* FPU state will be reallocated lazily at the first use. */
157157
drop_fpu(tsk);
158158
free_thread_xstate(tsk);
159-
} else if (!used_math()) {
160-
/* kthread execs. TODO: cleanup this horror. */
161-
if (WARN_ON(init_fpu(tsk)))
162-
force_sig(SIGKILL, tsk);
163-
user_fpu_begin();
159+
} else {
160+
if (!tsk_used_math(tsk)) {
161+
/* kthread execs. TODO: cleanup this horror. */
162+
if (WARN_ON(init_fpu(tsk)))
163+
force_sig(SIGKILL, tsk);
164+
user_fpu_begin();
165+
}
164166
restore_init_xstate();
165167
}
166168
}

arch/x86/mm/ioremap.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,18 +351,20 @@ int arch_ioremap_pmd_supported(void)
351351
*/
352352
void *xlate_dev_mem_ptr(phys_addr_t phys)
353353
{
354-
void *addr;
355-
unsigned long start = phys & PAGE_MASK;
354+
unsigned long start = phys & PAGE_MASK;
355+
unsigned long offset = phys & ~PAGE_MASK;
356+
unsigned long vaddr;
356357

357358
/* If page is RAM, we can use __va. Otherwise ioremap and unmap. */
358359
if (page_is_ram(start >> PAGE_SHIFT))
359360
return __va(phys);
360361

361-
addr = (void __force *)ioremap_cache(start, PAGE_SIZE);
362-
if (addr)
363-
addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK));
362+
vaddr = (unsigned long)ioremap_cache(start, PAGE_SIZE);
363+
/* Only add the offset on success and return NULL if the ioremap() failed: */
364+
if (vaddr)
365+
vaddr += offset;
364366

365-
return addr;
367+
return (void *)vaddr;
366368
}
367369

368370
void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)

drivers/firmware/efi/runtime-map.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
120120
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
121121
if (!entry) {
122122
kset_unregister(map_kset);
123-
return entry;
123+
map_kset = NULL;
124+
return ERR_PTR(-ENOMEM);
124125
}
125126

126127
memcpy(&entry->md, efi_runtime_map + nr * efi_memdesc_size,
@@ -132,6 +133,7 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
132133
if (ret) {
133134
kobject_put(&entry->kobj);
134135
kset_unregister(map_kset);
136+
map_kset = NULL;
135137
return ERR_PTR(ret);
136138
}
137139

@@ -195,8 +197,6 @@ int __init efi_runtime_map_init(struct kobject *efi_kobj)
195197
entry = *(map_entries + j);
196198
kobject_put(&entry->kobj);
197199
}
198-
if (map_kset)
199-
kset_unregister(map_kset);
200200
out:
201201
return ret;
202202
}

fs/efivarfs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
121121
int len, i;
122122
int err = -ENOMEM;
123123

124-
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
124+
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
125125
if (!entry)
126126
return err;
127127

0 commit comments

Comments
 (0)